title: How should I use rails and simple_form for nested resources?
body: <p>I'm trying to create one resource with another nested resource at the same time. I'm using Rails4 and simple_form 3.0.0rc. Here is my code.</p>
  
  <h1>Models:</h1>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_one :profile
    accepts_nested_attributes_for :profile
  end
  
  class Profile &lt; ActiveRecord::Base
    belongs_to :user
  end
  </code></pre>
  
  <h1>Controller:</h1>
  
  <pre><code>class UsersController &lt; ApplicationController
    def new
      @user = User.new
      @user.build_profile
    end
  
    def create
      user = User.new user_params
      user.save
      redirect_to root_url
  #    @par =params
    end
  
    private
      def user_params
        params.require(:user).permit(:email, profile_attributes: [:name])
      end
  end
  </code></pre>
  
  <h1>View (form for new user)</h1>
  
  <pre><code>&lt;%= simple_form_for @user do |f| %&gt;
    &lt;%= f.input :email %&gt;
    &lt;%= simple_fields_for :profile do |p| %&gt;
      &lt;%= p.input :name %&gt;
    &lt;% end %&gt;
    &lt;%= f.submit %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>When I submit the form, the <code>create</code> action receives this <code>params</code>:</p>
  
  <pre><code>{"utf8"=&gt;"✓",
  "authenticity_token"=&gt;"dJAcMcdZnrtTXVIeS2cNBwM+S6dZh7EQEALZx09l8fg=", 
  "user"=&gt;{"email"=&gt;"vasily.sib@gmail.com"},
  "profile"=&gt;{"name"=&gt;"Vasily"},
  "commit"=&gt;"Create User",
  "action"=&gt;"create",
  "controller"=&gt;"users"}
  </code></pre>
  
  <p>And after calling <code>user_params</code> the only thing that left is</p>
  
  <pre><code>{"email"=&gt;"vasily.sib@gmail.com"}
  </code></pre>
  
  <p>And, as you can see, there is nothing about <code>profile</code>, so no profile will be created.</p>
  
  <p>What am I doing wrong?</p>