I have a situation where I abstractly have a has_many through
relationship between three tables. Without the through, I'd have no
trouble passing the necessary value to the third table, but with it, I
have no access to the original object id.

This is what I've come up with but I'm wondering if there's not
something better (particularly since sql_conditions isn't really part
of the public API.)

  belongs_to :property_type

  has_many :properties,
           :through => :property_type do
    def sql_conditions
      conditions = "properties.integer_value = [EMAIL PROTECTED]"
      if base = super
        conditions = "(" + [ conditions, base ].join(")AND(") + ")"
      end
      conditions
    end
  end
--~--~---------~--~----~------------~-------~--~----~
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