Ruby on Rails Friday, October 1, 2010

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


and in the view i would put some


<%= @member.master_piece if member.is_artist?%>


all these IF artist are member. I would use STI if member are not artist but share a few fields like name and so, but if an artist has all the fields a member has and a few more, there is no need for STI.

--
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@googlegroups.com.
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.

No comments:

Post a Comment