Thanks Jeremy, your code got me rolling. I will be doing more reading
http://guides.rubyonrails.org/association_basics.html

On Tue, May 29, 2012 at 9:00 AM, Jeremy Walker <[email protected]> wrote:

>
>
> On 29 May 2012 13:26, Steve Knit <[email protected]> wrote:
>
>> Hello Jeremy, thanks for providing me your experience and quick
>> response!
>>
>
> You're welcome! So you know, it's customary to post your responses in the
> relevant place of a thread, rather than top-posting. It makes the
> conversation easier to follow.
>
>
>>
>> Here is my migration, sorry for being such a newb....
>>
>>
>> [loluser@fedora migrate]$ cat 20120527225053_create_pets.rb
>> class CreatePets < ActiveRecord::Migration
>>  belongs_to  :admin
>>  def self.up
>>    create_table :pets do |t|
>>      t.string :location
>>      t.string :public_key
>>
>>      t.timestamps
>>    end
>>  end
>>
>>  def self.down
>>    drop_table :pets
>>  end
>> end
>>
>
> You have the "belongs_to :admin" method in the wrong place. I'm interested
> that this even runs!
>
> Your create_table block should look like this:
>
>    create_table :pets do |t|
>      t.belongs_to  :admin
>
>      t.string :location
>      t.string :public_key
>
>      t.timestamps
>    end
>
> In this context, the belongs_to is part of the database creation schema
> and so must be placed within the create_table call.
>
> Try changing that and then redoing the migration (rake db:migrate:redo)
> and see whether that fixes things.
>
>
>
>>
>> --
>> 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 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/rubyonrails-talk?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en.

Reply via email to