Permalink
Browse files

Called singularize on nested model names in ajax_validator.rb to hand…

…le both one-to-one and one-to-many associations
  • Loading branch information...
1 parent f098354 commit 477934165249ee9f2200e19599d6846ae17f0091 @nfm committed Jul 14, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/better_form/ajax_validator.rb
View
2 lib/better_form/ajax_validator.rb
@@ -40,7 +40,7 @@ def ajax_validates_for(model, options = {})
nested_attributes_models = object.nested_attributes_options.keys
nested_attributes_models.each do |nested_model|
# Initialize an object of this nested_model
- klass = nested_model.to_s.camelize.constantize
+ klass = nested_model.to_s.singularize.camelize.constantize
object = klass.new
# Extract the object's attributes

0 comments on commit 4779341

Please sign in to comment.