lib/sequel/plugins/devise.rb in sequel-devise-0.0.8 vs lib/sequel/plugins/devise.rb in sequel-devise-0.0.9
- old
+ new
@@ -39,15 +39,37 @@
end
def update_attribute(key, value)
update_attributes key => value
end
+
+ private
+
+ def devise_safe_values
+ values.delete_if{|k, v| devise_safe_keys.include?(k) || k =~ /password/i }
+ end
+
+ def devise_safe_keys
+ ::Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION
+ end
end
module ClassMethods
def human_attribute_name(key)
key.to_s
+ end
+
+ module OverrideFixes
+ def inspect(safe = true)
+ return self.class.superclass.instance_method(:inspect).bind(self)[] unless safe
+ "#<#{self.class} @values=#{devise_safe_values.inspect}>"
+ end
+ end
+
+ def devise_modules_hook!
+ yield
+ include OverrideFixes
end
Model::HOOKS.each do |hook|
define_method(hook) do |method = nil, options = {}, &block|
if Symbol === (if_method = options[:if])