lib/mongoid/fields.rb in mongoid-3.0.11 vs lib/mongoid/fields.rb in mongoid-3.0.12
- old
+ new
@@ -442,12 +442,12 @@
def create_translations_setter(name, meth, field)
generated_methods.module_eval do
re_define_method("#{meth}_translations=") do |value|
attribute_will_change!(name)
if value
- value.update_values do |value|
- field.type.mongoize(value)
+ value.update_values do |_value|
+ field.type.mongoize(_value)
end
end
attributes[name] = value
end
end
@@ -481,12 +481,13 @@
pre_processed_defaults.delete_one(name)
post_processed_defaults.delete_one(name)
end
def field_for(name, options)
- return Fields::Localized.new(name, options) if options[:localize]
- return Fields::ForeignKey.new(name, options) if options[:identity]
- Fields::Standard.new(name, options)
+ opts = options.merge(klass: self)
+ return Fields::Localized.new(name, opts) if options[:localize]
+ return Fields::ForeignKey.new(name, opts) if options[:identity]
+ Fields::Standard.new(name, opts)
end
end
end
end