rails4 accessing params in controller from fullcalendar (3rd party API)
<p>I have a rails4 app and I'm trying to integrate it with fullcalendar. For fetching only the displayed events from db I'm trying to use <code>params['start']</code> and <code>params['end]</code> for my between_time scope. If I check the value of start and end params, the console says the value is nil. It's weird since in the logs I can see them for the json request. Why is it nil then? What should I do to be able to use them for my scope?</p>

<p>controller</p>

<pre><code>@user = current_user
@event = Event.new
@events = Event.allevents(current_user).between_time(params['start'], params['end']) if (params['start'] &amp;&amp; params['end'])
respond_to do |format|
  format.html
  format.json { render: @events }
end
</code></pre>

<p>logs on server</p>

<pre><code>Started GET "/users/1/events" for ::1 at 2016-01-02 15:05:31 -0800
15:05:31 puma.1       | Processing by EventsController#index as HTML
15:05:31 puma.1       |   Parameters: {"user_id"=&gt;"1"}

Started GET "/users/1/events?start=2015-12-27&amp;end=2016-01-03&amp;_=1451775933354" for ::1 at 2016-01-02 15:05:34 -0800
15:05:34 puma.1       | Processing by EventsController#index as JSON
15:05:34 puma.1       |   Parameters: {"start"=&gt;"2015-12-27", "end"=&gt;"2016-01-03", "_"=&gt;"1451775933354", "user_id"=&gt;"1"}
</code></pre>

<p>The following code is an example app I checked. In this code the params seem to be working properly. I don't see the difference compared to my code when it comes to getting the params.</p>

<pre><code>def get_events
  start_time = Time.at(params[:start].to_i).to_formatted_s(:db)
  end_time   = Time.at(params[:end].to_i).to_formatted_s(:db)

  @events = Event.where('
              (starttime &gt;= :start_time and endtime &lt;= :end_time) or
              (starttime &gt;= :start_time and endtime &gt; :end_time and starttime &lt;= :end_time) or
              (starttime &lt;= :start_time and endtime &gt;= :start_time and endtime &lt;= :end_time) or
              (starttime &lt;= :start_time and endtime &gt; :end_time)',
              start_time: start_time, end_time: end_time)
  events = []
  @events.each do |event|
    events &lt;&lt; { id: event.id,
                title: event.title,
                description: event.description || '', 
                start: event.starttime.iso8601,
                end: event.endtime.iso8601,
                allDay: event.all_day,
                recurring: (event.event_series_id) ? true : false }
  end
  render json: events.to_json
end
</code></pre>