Skip to content

Rails 4 undefined method `_run_validate_#{group}_callbacks' for #<Quote:0x00000101da89a8> #10

Description

@peterbeers

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:inmethod_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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions