Ruby on Rails Tuesday, April 12, 2016

On 12 April 2016 at 19:10, David Williams <lists@ruby-forum.com> wrote:
> Colin Law wrote in post #1182803:
>> On 12 Apr 2016 6:58 p.m., "David Williams" <lists@ruby-forum.com> wrote:
>>>
>>> shahroon ali wrote in post #1182801:
>>> > belongs_to :states should be :state singular.
>>> >
>>> > On Tue, Apr 12, 2016 at 10:47 PM, David Williams <lists@ruby-forum.com>
>>>
>>> I fixed the typo, but it's still not working.
>>>
>>> undefined method `state_id' for #<Profile:0xd1b0b00>
>>
>> Is there a column of that name in the profiles table?
>>
>> Colin
>>
>>>
>>> --
>>> Posted via http://www.ruby-forum.com/.
>>>
>>> --
>
> I thought the table automatically creates the _id extension by default.

How can a table automatically create a column? If you have profile
belongs_to state then you have to create a migration to put the
state_id column in the database. I think you need to follow the
advice that has now nearly worn out my keyboard, so many times have I
typed it: You should work right through a good tutorial such as
railstutorial.org (which is free to use online). That will show you
the basics of Rails.

>
> My categories table is nearly identical to the state table.

What has the categories table got to do with it? I thought this
problem is about profiles and states.

Colin

>
> categories
> id
> name
> created_at
> updated_at
> description
> slug
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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/427484d2eb63ca497a1af43aa77134af%40ruby-forum.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/CAL%3D0gLu1dGx6-KNtscWr1nkVDanikLmELuiDgv2f0pOrdFG3nA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment