title: Rails Strong Parameters - what if one of my fields is optional?
body: <p>I'd not claim myself to be an expert in Rails by any stretch.  One of the things that confuses me is Strong Parameters, and I've not found any really straightforward tutorials on it, with the majority of the search results dominated by hits on the rails documentation which, whilst normally accurate, I don't find in any way easy to read and can't be considered a tutorial.  The github for strong params also doesn't appear to cover this.</p>
  
  <p>Say I have an entity called "Resource".</p>
  
  <pre><code>class ResourcesController &lt; ApplicationController
    ...
    def create
      @resource = Resource.new(resource_params)
      if @resource.save
        ...
        respond_with(@resource.level)
      else
        ...
      end
    end
  
    def update
      if @resource.update(resource_params)
        ...
        respond_with(@resource.level)
      else
        ...
      end
    end
    ...
    def resource_params
      params.require(:resource).permit(:name, :url, :description, :level_id)
    end
  end
  </code></pre>
  
  <p>Assume I have a scaffolded form which displays the fields for name, url, description and level_id.  All of the fields are mandatory.  I don't know how to amend the resource_params function to ensure that name, url and level_id are mandatory when updating (or creating) a resource, but that description is optional (but should still be permitted).</p>
  
  <p>I've tried removing description from the require line, and adding it on a separate line as params.permit(:description) but that has not made any difference, the field is still mandatory in the form.</p>
  
  <p>Any assistance on this would be welcomed!</p>