Sha256: 84d5026850251282cf057ddde83d6c56a4143dfed2434be2c32175fc8a7ca038
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require 'dm-devise' require 'devise/schema' module Devise module Orm module DataMapper module Schema include Devise::Schema SCHEMA_OPTIONS = { :null => :required, :limit => :length } # Tell how to apply schema methods. This automatically maps :limit to # :length and :null to :required. def apply_devise_schema(name, type, options={}) return false if properties[name] SCHEMA_OPTIONS.each do |old_key, new_key| next unless options.key?(old_key) if :null == old_key # :required is opposite of :null options[new_key] = !options.delete(old_key) else options[new_key] = options.delete(old_key) end end if String == type && !options[:length] options[:length] = 255 end options[:required] ||= false options.delete(:default) if options[:default].nil? property name, type, options end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dm-devise-2.0.1 | lib/devise/orm/data_mapper/schema.rb |
dm-devise-2.0.0 | lib/devise/orm/data_mapper/schema.rb |