On Oct 1, 7:09 am, radhames brito <[email protected]> wrote:
> Yes, if the member will become an artist but and artist still has all the
> attributes of a member, is better to have one model with conditional
> validation, something like.
>
> validates :master_piece, :presence => true, :if => is_artist?
>
> def is_artist?
>  artist
> end
>

As an aside, there's an even nicer syntax:

validates :master_piece, :presence => ture, :if => artist?

If "artist" is the name of a boolean column, ActiveRecord provides
"artist?" automatically.  (Also, is_? style is more prevalent in
Java/.NET, but not in Ruby).

Jeff

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to