Dudebot wrote:
> Here's a question:
> 
> I have the exact same validation code in 2 different models.
> 
> OK, you're thinking, combine the models. 

That shouldn't ever be your first reaction.  First reaction is to 
refactor out the commonalities.

If either, or both models end up as skeletons, then you should rethink 
your original design...  why were they separate in the first place? 
Lack of analysis. or alot of analysis that you've forgotten that tiny 
important bit form which led you to separate them in the first place.

> 
> So, in Rails, is there a way to reference the same validation for 2
> different models?
> 

As mentioned previously, plugins, or a parent abstract class depending 
on the breadth of commonalities.
-- 
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 [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