Module: Devise::Orm::DataMapper::Schema
- Includes:
- Schema
- Defined in:
- lib/devise/orm/data_mapper/schema.rb
Constant Summary collapse
- SCHEMA_OPTIONS =
{ :null => :required, :limit => :length }
Instance Method Summary collapse
-
#apply_devise_schema(name, type, options = {}) ⇒ Object
Tell how to apply schema methods.
Instance Method Details
#apply_devise_schema(name, type, options = {}) ⇒ Object
Tell how to apply schema methods. This automatically maps :limit to :length and :null to :required.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/devise/orm/data_mapper/schema.rb', line 17 def apply_devise_schema(name, type, ={}) SCHEMA_OPTIONS.each do |old_key, new_key| next unless .key?(old_key) if :null == old_key # :required is opposite of :null [new_key] = !.delete(old_key) else [new_key] = .delete(old_key) end end .delete(:default) if [:default].nil? property name, type, end |