I have a nested resource:
resources :users do
resources :cust_uploads
end
After uploads are made, I can view a list of them under the users index page:
<% @user.cust_uploads.each do |up| %>
<li><%= up.name %></li>
<% end %>
But when I go to: /users/3/cust_uploads/1 I get a record not found error: Couldn’t find CustUpload with id=1. Am I not saving to DB properly?
Any idea whats happening or how I can diagnose?
schema has no ID columns but I thought that was automatic?
ActiveRecord::Schema.define(:version => 20130109001001) do
create_table "cust_uploads", :force => true do |t|
t.string "name"
t.string "cust_file_url"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "user_id"
end
create_table "users", :force => true do |t|
t.string "email"
t.string "password_digest"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
end
Maybe 1 is not the ID of the created model. Try printing them like this and then click on a model: