title: strong parameter and json input rails 4
body: <p>I am trying to save data through JSON String in which I have nested associated attributes. I do not want to use attr_accessible. I almost got the logic of strong parameter but still got the problem to make them work. I am getting JSON string and using it to save data using this </p>
  
  <pre><code>data = request.body.read
  @inputData = Person.new(JSON.parse(data))
  @inputData.save!
  if@inputData.valid?
    render :status =&gt; 200, :json =&gt; "Data inserted successfully"
  else
    render :status =&gt; 404, :json =&gt; "Not Inserted "
  end
  </code></pre>
  
  <p>I have defined permit strong parameter method allow nested attributes like this</p>
  
  <pre><code>def referral_params
  params.require(:person).permit(:id, user_attributes: [:id, :first_name, :last_name, :email], device_attributes: [:id, :os_type, :os_version], location_attributes: [:id, :latitude, :longitude], duration_attributes[:id, :start_time, :end_time]) end
  </code></pre>
  
  <p>But I am not sure how to use this regerral_params method along with JSON input string....</p>