KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Hi (huge Rails newbie here), I have the following models: class Shop < ActiveRecord::Base belongs_to :user validates_uniqueness_of :title, :user_id, :message => "is already being used" end and class User < ActiveRecord::Base has_one :shop, :dependent => :destroy end When I'm about to create a new shop, I get the following error: private method `create' called for nil:NilClass This is my controller: @user = current_user @shop = @user.shop.create(params[:shop]) I've tried different variations by reading guides and tutorials here and there, but I'm more confused than before and can't get it to work. Any help would be greatly appreciated.
Tags (comma-separated)
Save Edits
Cancel