Re: Syntax q on ActiveRecord
by Matt Neuburg other posts by this author
Oct 31 2006 11:15AM messages near this date
Re: Syntax q on ActiveRecord
|
Re: Syntax q on ActiveRecord
Ike <rxv@[...].com> wrote:
> In my model, if I have a field, that contains the id to another table, twice
> (like, primary associate and a secondary associate) I am specifying this as
>
> class Customer < ActiveRecord::Base
> belongs_to: associate :foreign_key => "associatekey1"
> belongs_to: associate :foreign_key => "associatekey2"
> end
>
> This doesn't work -- but my question is how SHOULD the syntax for specifying
> this look?
Just RTFM.
<http://api.rubyonrails.org/>
(s.v. "belongs_to):
belongs_to :firm, :foreign_key => "client_of"
Notice the comma? Notice where the colons go?
m.
PS The fact that you could bring yourself to write belongs_to: suggests
that you don't know Ruby. Over the course of a long life in computers I
have found that it is helpful to know the basics of the language in
which one is programming (though, to be quite honest, I've written quite
a bit of Perl without obeying that rule)...
--
matt neuburg, phd = matt@[...].com, http://www.tidbits.com/matt/
Tiger - http://www.takecontrolbooks.com/tiger-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com
Thread:
Ike
Mike Harris
Gavin Kistner
Bill Kelly
Matt Neuburg
Ryan Davis
Mike Harris
Michael W. Ryder
Jeffrey Schwab
Ike
Mike Harris
Ryan Davis
Ike
Matt Neuburg
Nate Wiger
|