title: Require nested params
body: <p>I have a Rails server with a RESTful API allows to create "communities" with "users".</p>
  
  <p>To create a community I POST a JSON like this:</p>
  
  <pre><code>{
      "community": {
          "name": "community name"
      }
  }
  </code></pre>
  
  <p>to <em>/api/v1/communities</em>. The problem is that "name" must be mandatory, so if in CommunitiesController I do...</p>
  
  <pre><code>def community_params
      params.require(:community).permit(:name)
  end
  </code></pre>
  
  <p>...and name is missing, I the user could create a community without name.</p>
  
  <p>I'll like to force the presence of "name". I have tried to do</p>
  
  <pre><code>def community_params
      params.require(:community)
      params.require(community: [ :name ])
  end
  </code></pre>
  
  <p>but I get </p>
  
  <blockquote>
    <p>ActionController::ParameterMissing in
    Api::V1::CommunitiesController#create param is missing or the value is
    empty: {:community=>[:name]}</p>
    
    <p>Request</p>
    
    <p>Parameters:</p>
    
    <p>{"community"=>{"name"=>"community name"}}</p>
  </blockquote>
  
  <p>How can I force the presence of a non-empty value of name?</p>
  
  <p>Thanks in adance</p>