Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation needs update #12

Open
wrkrb33 opened this issue Jun 6, 2014 · 0 comments
Open

documentation needs update #12

wrkrb33 opened this issue Jun 6, 2014 · 0 comments

Comments

@wrkrb33
Copy link

wrkrb33 commented Jun 6, 2014

Currently, the last bit of the Usage section reads:

To define validation blocks just use the respective group validation method, like so

class Person < ActiveRecord::Base
  validation_group :name do
     validates_presence_of :first_name
     validates_presence_of :last_name
  end

  validate_name           {|r| # something custom on save }
  validate_name_on_create {|r| # something custom on create }
  validate_name_on_update {|r| # something custom on update }
end

But unless I am seriously mistaken, it should be more like:

To define validation blocks just include a custom 'validate' method within the validation group, like so

class Person < ActiveRecord::Base
  validation_group :name do
    validates_presence_of :first_name
    validates_presence_of :last_name
    validate           {|r| # something custom on save }
    validate_on_create {|r| # something custom on create }
    validate_on_update {|r| # something custom on update }
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant