Hi,
I have many "has_and_belongs_to_many" that looks nearly the same, I
wonder if I can do anything so I DRY myself? maybe write a plugin? What
do you think?
The lines look like this.
has_and_belongs_to_many :snippets,
:class_name =>
''Container::Snippet'',
:conditions => [ "containers.reference_type
''Layout'' AND containers.container_type =
''Snippet''" ]
:join_table => :containers,
:foreign_key => :reference_id,
:association_foreign_key => :container_id
has_and_belongs_to_many :modules,
:class_name =>
''Container::Module'',
:conditions => [ "containers.reference_type
''Layout'' AND containers.container_type =
''Module''" ]
:join_table => :containers,
:foreign_key => :reference_id,
:association_foreign_key => :container_id
has_and_belongs_to_many :texts,
:class_name => ''Container::Text'',
:conditions => [ "containers.reference_type
''Layout'' AND containers.container_type =
''Text''" ]
:join_table => :containers,
:foreign_key => :reference_id,
:association_foreign_key => :container_id
Hope someone have a solution, thanks for help :)
Regards,
Jamal
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---