i finded solution!

#Follow Model
belongs_to :target, :foreign_key => 'target_id', :class_name => 'User'

#User Model
has_many :followings, :foreign_key => "target_id", :through
=> :following_members, :source => :target


On 7월29일, 오전9시49분, hiphapis <[email protected]> wrote:
> ohoo, really? ;(
>
> i solved by "find_sql"
> i don't like it ;p
>
> On Jul 29, 12:09 am, Matt Jones <[email protected]> wrote:
>
>
>
> > It's going to be hard to give advice without the source to the Follow
> > model - that will determine what you need to specify in
> > has_many :through.
>
> > --Matt Jones
>
> > On Jul 27, 4:17 am, hiphapis <[email protected]> wrote:
>
> > > Hi Guys.
> > > (I'm Asian. so my eng is very poor. sorry!)
>
> > > i want tochange:foreign_key on has_many :through
> > > code is
>
> > > has_many :following_members, :class_name => "Follow", :dependent
> > > => :destroy
> > > has_many :followings, :foreign_key => "target_id", :through
> > > => :following_members, :source => :user
>
> > > but return is don't used foreign_key(target_id)
>
> > > i think.. solution is
> > > 1. use "find_sql"
> > > 2. def followings
> > > but i don't like these.
--~--~---------~--~----~------------~-------~--~----~
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