Skip to content

documentation needs update #12

Description

@wrkrb33

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

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