On 9 May 2012 11:29, mcasimir <[email protected]> wrote: > About 'this is duplicated code': what about STI? > > eg > class Content < AR::Base > class Article < Content > class Video < Content > > Here Video instances will respond to :text, and Article will respond_to :url > without batting an eye. moreover even in the schema.rb the 'contents' table > schema is all you can find.. perhaps this is a consequence of ActiveRecord > not yet supporting STI very well. > > there is a very important information here: text is something that belongs > to Article, and url is something that belongs to Video.
Shouldn't you be using a polymorphic association for those type-specific fields then, rather than STI? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en.
