title: undefined method `empty?' for nil:NilClass when trying to add a error validation messege
body: <p>I am trying to add a validation in my code where if the user puts more than 4 digits it push an error message. I want to be able to add an error message when the user enters in the durations field a number lager than 4 digits the error pops up and reloads the page again.</p>
  
  <p>this was my controller before validation</p>
  
  <pre><code>unless params[:searched] 
          @filters[:duration] ||= Hash.new
          @filters[:duration][:durations] = ['1']
          @filters[:duration][:operators] = [:gt]
        end
  
        if @filters.try(:[],:duration).try(:[],:durations)
          @filters[:duration][:durations].map!(&amp;:to_i)
        end
  @recording_metadata = RecordingMetadata.find(@tenant, request.session_options[:id], (start_time..end_time), @filters, additional_options)
  </code></pre>
  
  <p>this is my controller right now where I have my code</p>
  
  <pre><code>     unless params[:searched] 
          @filters[:duration] ||= Hash.new
          @filters[:duration][:durations] = ['1']
          @filters[:duration][:operators] = [:gt]
        end
  
        if @filters.try(:[],:duration).try(:[],:durations)
          @filters[:duration][:durations].map!(&amp;:to_i)
        end
  if @filters[:duration][:durations].length &lt;= 4 
          @recording_metadata = RecordingMetadata.find(@tenant, request.session_options[:id], (start_time..end_time), @filters, additional_options)
        else
          Notice.rpush("4 digits")
          save_notice
          render action: :index
        end
  </code></pre>
  
  <p>this is my view where the error is happening at in my view</p>
  
  <pre><code> - unless @recording_metadata.empty?
  </code></pre>