Zack,
Tuesday, July 13, 2010, 3:25:03 PM, you wrote: ZN> Ok so basically I have a problem. Im relatively new to rails and i seem ZN> to have come to a dead end. I wanted a model that could either be a URL, ZN> a video, a picture or a sound recording. Obviously this is impossible. I ZN> am gonna use attachment_fu if that helps. So whats the most DRY way of ZN> doing this. Each media thing, whether it be a video, a picture, a URL or ZN> a sound file must be classified under the same thing as, lets say a ZN> media object. Consequently they share attributes, like an id, a upload ZN> date, a description etc. However they differ in their actual media ZN> format. ZN> Does anyone know how I should make my models and controllers. ZN> Thanks! ZN> -- ZN> Posted via http://www.ruby-forum.com/. Two possibilities come to mind: Subclassing and Mixins. You can create ----------- class MediabBase < ActiveRecord::Base #attributes end class VideoMedia < MediaBase #more attributes end class JpegMedia < MediaBase #other attributes end ----------- Ill let someone else explain how to do Mixins. Caution: I've been doing Rails for about 6 months but still consider myself a novice. My answer may be grossly wrong. -- 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.

