Hi,

I'm currently having the situation where I have to implement a polymorphic 
has_and_belongs_to_many by introducing an in between model that handles all 
the "has_many :as" and "belongs_to :polymorphic" association 
implementations... and is not doing anything else. Thing I don't like it 
here is, I am unnecessarily loading AR instances only to execute SQL that 
leads me to whatever data I want to fetch. I would then gladly remove the 
models, keep the DB tables, and have is all work with some kind of 
has_and_belongs_to_many polymorphic magic. Something like:

class Song < ActiveRecord::Base
  has_and_belongs_to_many :genres, :as => :taggableend
class Genre < ActiveRecord::Base
  has_and_belongs_to_many :taggables, :polymorphic => trueend

or similar, I haven't put much thought into that. I would like to hear some 
opinion of more experienced Rails developers to know if this would be a 
valuable feature. 
 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-core/-/ZMvXmkwc88oJ.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to