ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved