Rails - Param is missing or the value is empty
<p>Lately, I've connected <a href="http://amsul.ca/pickadate.js/" rel="nofollow">pickadate</a> gem. Now my <code>_form</code> looks like this:</p>

<pre><code>&lt;%= form_for(@event, :html =&gt; {:class =&gt; 'form-horizontal'}) do |f| %&gt;
&lt;%= render('error_message') %&gt;

&lt;div class="field form-group"&gt;
  &lt;%= f.label :name %&gt;
  &lt;%= f.text_field :name, class: "form-control" %&gt;
&lt;/div&gt;

&lt;div class="field form-group"&gt;
  &lt;%= f.label :start_time %&gt;
  &lt;%= f.text_field :start_time, class: "datepicker form-control"%&gt;
&lt;/div&gt;

&lt;div class="actions"&gt;
  &lt;%= f.submit 'Save', class: "btn btn-success" %&gt;
&lt;/div&gt;
&lt;% end %&gt;

&lt;script type="text/javascript"&gt;
    $('.datepicker').pickadate({
        //customization
    })
&lt;/script&gt;
</code></pre>

<p>Here is <code>new.html.erb</code>:</p>

<pre><code>&lt;% provide(:title, t('new_event_title')) %&gt;

&lt;h1&gt;&lt;%= t('new_event_h1') %&gt;&lt;/h1&gt;

&lt;%= render 'form' %&gt;
</code></pre>

<p>As you see, <code>Event</code> model has 2 parameters: <code>name</code> (string type) and <code>start_time</code> (datetime type). Here is my <code>create</code> method and <code>event_params</code>:</p>

<pre><code>def create
    @event = Event.new(event_params)
    redirect_to events_path
end

def event_params
    params.require(:event).permit(:name, :start_time)
end
</code></pre>

<p>But, by clicking 'Save' button I've got the following error:</p>

<pre><code>ActionController::ParameterMissing in EventsController#create
    param is missing or the value is empty: event
</code></pre>

<p>Here is the server log:</p>

<pre><code>Started POST "/events" for ::1 at 2016-03-07 15:23:08 +0300
Processing by EventsController#create as HTML
Can't verify CSRF token authenticity
{"controller"=&gt;"events", "action"=&gt;"create"}
Completed 400 Bad Request in 2ms (ActiveRecord: 0.0ms)
</code></pre>

<p>My rendered _form:</p>

<pre><code>&lt;form class="form-horizontal" id="new_event" action="/events" accept-charset="UTF-8" method="post"&gt;&lt;input name="utf8" type="hidden" value="&amp;#x2713;" /&gt;&lt;input type="hidden" name="authenticity_token" value="jvg+&lt;...&gt;Q==" /&gt;


&lt;div class="field form-group"&gt;
  &lt;label for="event_name"&gt;Name&lt;/label&gt;&lt;br&gt;
  &lt;input class="form-control" type="text" name="event[name]" id="event_name" /&gt;
&lt;/div&gt;

&lt;div class="field form-group"&gt;
  &lt;label for="event_start_time"&gt;Start time&lt;/label&gt;&lt;br&gt;
  &lt;input class="datepicker form-control" type="text" name="event[start_time]" id="event_start_time" /&gt;
&lt;/div&gt;

&lt;div class="actions"&gt;
  &lt;input type="submit" name="commit" value="Save" class="btn btn-success" /&gt;
&lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>Something wrong with form I guess. Any ideas? Thanks in advance!</p>