Thank you!
On 16 Sep., 18:45, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On 16 Sep 2008, at 17:35, eleasar wrote:
>
>
>
> > I have a problem with the :include option in find for my
> > has_one :through association.
>
> > I have Users, Profiles and Customers, all connected to each other with
> > a has_one :through => :membership association like this:
>
> :including of has_one :through is basically just broken on rails 2.1.
> It's fixed on edge.
>
> Fred
>
> > class Profile < ActiveRecord::Base #could also be user or customer
>
> > has_one :membership # i saw an acrticle of Ryan about
> > has_one :through, there this would be has_many, is this wrong?
> > has_one :user, :through => :membership
> > has_one :customer, :through => :membership
>
> > end
>
> > now if I search for profiles with the :include option:
>
> > def index
> > [EMAIL PROTECTED] = User.find(:all, :include => [:user, :customer])
> > end
>
> > i get an error:
>
> > Mysql::Error: #42S22Unknown column 'users.profile_id' in 'on clause'
>
> > obviously, it searches for the profile_id on the wrong place, it
> > should search it in memberships
>
> > anyone has an idea? Thanks..
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---