Rails4: Method Error in Show Page
I have USERS which have LISTINGS and a SHOP.
I just created the Shop Controller and in my def show action i'm messing
things Up.
When a user creates a Shop it passes a user_id to the shop so every shop
belongs to a User.
class AddUserIdToShops < ActiveRecord::Migration
def change
add_column :shops, :user_id, :integer
add_index :shops, :user_id
end
end
But on the Show Page i can not call @user.name for example because rails
don't know what user i mean.
How can i set up my show action properly so the i can call @user ?
Thank you
No comments:
Post a Comment