Ruby on Rails Tuesday, March 28, 2017

where do you see a string?
association is called :ProvincialTaxAreaCode (because of simple_form_for
the associated class is called TaxArea
the fkey is ProvincialTaxAreaCode (varchar20)



On Tue, Mar 28, 2017 at 2:55 PM, Hassan Schroeder <hassan.schroeder@gmail.com> wrote:
On Tue, Mar 28, 2017 at 10:37 AM, tom <tomabroad@gmail.com> wrote:

> model:
>    belongs_to :ProvincialTaxAreaCode, class_name: "TaxArea", foreign_key:
> "ProvincialTaxAreaCode" #, primary_key: "ProvincialTaxAreaCode"
>
> ProvincialTaxAreaCode is a varchar(20)

?? A model "belongs_to" another model, not a string.

This might help:

http://guides.rubyonrails.org/association_basics.html#the-belongs-to-association

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yDsk1f_uGp3Ypzt1K3sMg873XA7OYV4uMVjaojTm74q2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMe%3DrNSXpneRymZc3_4Gpts8%2BHTA6vehFru1WEZXO2yvfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment