grouped_validations
grouped_validations copied to clipboard
Rails 4 undefined method `_run_validate_#{group}_callbacks' for #<Quote:0x00000101da89a8>
Rails 4.0.1 Ruby 2.0.0-p247
I defined a group called :offer in my Quote model.
validation_group :offer do validates_presence_of :initials end
When I start the console and test the following:
[1] pry(main)> q = Quote.new
[2] pry(main)> q.valid?
NoMethodError: undefined method _run_validate_offer_callbacks' for #<Quote:0x00000101da89a8> from /Users/peter/.rvm/gems/ruby-2.0.0-p247/gems/activemodel-4.0.1/lib/active_model/attribute_methods.rb:439:in
method_missing'
Same happens for q.groups_valid?(:offer)
I noticed that it works when you replace:
send(:"_run_validate_#{group}_callbacks")
with:
run_callbacks(:"validate_#{group}")
But I don't know if it's the proper way.
@peterbeers Did you find out if this is a proper way to fix these errors?
@sajoku No, I never did. I'm using the reform gem now.
It might be the old topic, however I managed to force it (proper word) to work with rails 4.1+ - https://github.com/BroiSatse/grouped_validations
BroiSatse, thank you, it does work with Rails 4.2.4...
Here is a link to the changes made to the actual gem: https://github.com/BroiSatse/grouped_validations/commit/49f634a655391aade53870ab4e7091d6605c2208