OrmAdapter::Fmrest
Adds Filemaker Rest to the orm_adaptor project.
ORM Adapter
Provides a single point of entry for popular ruby ORMs. Its target audience is gem authors who want to support more than one ORM.
For more information see the orm_adapter project.
FmRest
A Ruby client for FileMaker's Data API with ActiveRecord-ish ORM features.
For more information see the fmrest-ruby gem.
Installation
Add this line to your application's Gemfile:
gem 'orm_adapter-fmrest'
And then execute:
$ bundle
Or install it yourself as:
$ gem install orm_adapter-fmrest
Devise
Devise is a flexible authentication solution for Rails.
For more information see the Devise.
And now you can use Devise authentication based on Filemaker REST ORM.
Add the following lines to Gemfile:
gem 'fmrest-ruby'
gem 'orm_adapter-fmrest'
gem 'devise'
And then configure Devise using "--orm fmrest" parameter:
$ rails generate devise:install --orm fmrest
or require 'devise/orm/fmrest' in your config/initializers/devise.rb manually.
After that you can create User model:
class User < FmRest::Layout
layout('your_user_layout')
extend Devise::Models
include ActiveModel::Validations
include ActiveModel::Validations::Callbacks
devise :database_authenticatable, :rememberable, :trackable
end
Date/Time coerce
as Devise uses time calculation, FileMaker Date/Time fields must be converted from the internal string representation to Date/Time classes.
fmrest
needs to be configured to do so, see DateFields in the fmrest documentation.
Set either in FmRest.default_connection_settings
or in the model's fmrest_config
coerce_dates: true
or
coerce_dates: :full
Known Limitations and Issues
- There is no unit test. Fill free to add it.
Acknowledge
Part of the code and logic (i.e. devise compatibility) is ripped from orm_adapter-her.
Contributing
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
License
The gem is available as open source under the terms of the MIT License.