Hi Jean-Sébastien,
Aren''t you trying to do this instead?
1/
class Store < ActiveRecord::Base
has_many :store_shipping_countries
has_many :store_entries, :through => :store_shipping_countries
end
2/
class StoreShippingCountry < ActiveRecord::Base
belongs_to :store
has_many :store_entries
end
3/
class StoreEntry < ActiveRecord::Base
belongs_to :StoreShippingCountry
end
On 3-May-07, at 18:47 , wrote:
>
> another active record question :
> i''ve got 3 classes :
>
> 1/
> class Store < ActiveRecord::Base
> has_many :store_entries
> has_many :store_shipping_countries
> end
>
> 2/
> class StoreShippingCountry < ActiveRecord::Base
> belongs_to :store
> has_many :store_entries,
> :through => :store
> end
>
> 3/
> class StoreEntry < ActiveRecord::Base
> belongs_to :store
> has_many :store_shipping_countries,
> :through => :store
> end
>
> in store entry i''m calling store_shipping_countries and here is
what
> i''ve got in the log file :
>
> store_shipping_countries.* FROM store_shipping_countries INNER JOIN
> stores ON store_shipping_countries.store_id = stores.id WHERE
> ((stores.store_id = 1004))
>
> i don''t understand how it build the WHERE clause
"((stores.store_id > 1004))". it should be (store_entries.id =
1004) !
>
> please help.
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---