Reputation: 1915
I'm using Rails v4.0.0 and I'm trying to create a form with date type
here's the form
<%= form_for(@booking, remote: true) do |b| %>
<header>
<h1>Edit booking</h1>
</header>
<%= p.date_field :check_in, placeholder: "Check-in" %>
<%= p.date_field :check_out, placeholder: "Check-out" %>
<%= p.number_field :units, placeholder: "Units" %>
<%= p.submit "Save" %>
<% end %>
but I get an
undefined method `date_field' for nil:NilClass
any ideas what's wrong?
Upvotes: 1
Views: 429
Reputation: 40323
At the form for you say the builder is b
:
form_for(@booking, remote: true) do |b|
But when you use it you say it's p
:
p.submit "Save"
And given it's a form builder, I'd rather have it called f
.
Upvotes: 4