Closed adriennedao closed 7 years ago
what is the contents of db/schema.rb
?
create_table "recipes", force: :cascade do |t| t.string "name" t.string "img_url" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "user_id" t.index ["user_id"], name: "index_recipes_on_user_id", using: :btree end
hmm that looks right. and can i see recipes controller create action?
create_table "users", force: :cascade do |t| t.string "username" t.string "password" end
add_foreign_key "ingredients", "recipes" add_foreign_key "recipes", "users" end
def create @recipe = Recipe.create!(recipe_params.merge(user: @current_user)) redirect_to @recipe en
hmm maybe try stopping and restarting your rails server? everything looks right to me...
Still not working. Restarted the server.
ok let's try to narrow this down to either a database issue or a controller issue.
in db/seeds.rb can you add:
Recipe.create!(name:'my recipe', user: User.last)
and try seeding - any errors?
To Jesse: still unable to create the new recipe after having updated info on the def method. Error appeared again as "can't write unknown attribute
user_id
".