Ruby on Rails
Tuesday, May 29, 2012
On 29 May 2012 13:14, Steve Knit <lists@ruby-forum.com> wrote:
Thanks for pointing me to @pets = admin.pets.all but now I'm getting the
error
ActiveRecord::StatementInvalid in PetsController#index
SQLite3::SQLException: no such column: pets.admin_id: SELECT
"pets".* FROM "pets" WHERE ("pets".admin_id = 1)
Rails.root: /home/heptagone/dev/app2/devise_example
Application Trace | Framework Trace | Full Trace
app/controllers/pets_controller.rb:7:in `index'
The error message says that the pets table does not have a column "admin_id". Have you checked to see whether your pets table has a column called admin_id? What does your migration for the pets table look like?
I have already done the command "bundle exec rake:db migrate" so I'd
thing that admin_id would already part of pets as you can see my models
in my original post
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment