Sha256: 66088c3a5923451a4bfa1b1a3f10f983e153db84465bbe1044f1e2c046164c90
Contents?: true
Size: 998 Bytes
Versions: 1
Compression:
Stored size: 998 Bytes
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={}) 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.delete(:default) if options[:default].nil? property name, type, options end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dm-devise-1.1.4 | lib/devise/orm/data_mapper/schema.rb |