On 26 Mar 2008, at 09:13, Cai Guichao wrote:
>
> # File activerecord/lib/active_record/validations.rb, line 327
> 327: def validate(*methods, &block)
> 328: methods << block if block_given?
> 329: write_inheritable_set(:validate, methods)
> 330: end
>
On an array << is just append. Why do you ask ?
Fred> there is an example:
> class Comment < ActiveRecord::Base
> validate do |comment|
> comment.must_be_friends
> end
>
> def must_be_friends
> errors.add_to_base("Must be friends to leave a comment")
unless
> commenter.friend_of?(commentee)
> end
> end
> Understand how this matter?
> --
> Posted via http://www.ruby-forum.com/.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---