On 1 juil, 12:57, "Sergio Cambra .:: entreCables S.L. ::."
<[email protected]> wrote:
> On Miércoles, 1 de Julio de 2009 11:53:28 Sylvain escribió:
>
> > Hi again,
> > I have two Models has follow:
>
> > Class Device
> > has_many :links, :foreign_key => "src_device_id"
> > has_many :links, :foreign_key => "dst_device_id"
>
> This is wrong, you can't have two associations with the same name, rails will
> ignore the first association. If you try in the console (script/console)
> Device.first.links you can see SQL generated by rails will be use
> dst_device_id.
>
One question about that,
I've done taht in order to be OK with rails:
Class Device
has_many :src_links, :class_name => "Link", :foreign_key =>
"src_device_id"
has_many :dst_links, :class_name => "Link", :foreign_key =>
"dst_device_id"
Now I would like to have column 'Link' which would behave like a
normal "has_many" columns (i.e. ability to click and to see the links)
So first I did that:
def links
src_links + dst_links
end
But that doesn't do what I want...
Is there any other way to do that?
Thanks in advance,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---