title: Rails: create on has_one association
body: <p>Hi (huge Rails newbie here), I have the following models:</p>
  
  <pre><code>class Shop &lt; ActiveRecord::Base
    belongs_to :user
    validates_uniqueness_of :title, :user_id, :message =&gt; "is already being used"
  end
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_one :shop, :dependent =&gt; :destroy
  end
  </code></pre>
  
  <p>When I'm about to create a new shop, I get the following error:</p>
  
  <pre><code>private method `create' called for nil:NilClass
  </code></pre>
  
  <p>This is my controller:</p>
  
  <pre><code>@user = current_user
  @shop = @user.shop.create(params[:shop])
  </code></pre>
  
  <p>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.</p>