I keep getting a NoMethodError for my form_for
This is in my _form.html.erb
<%= form_for @booking do |f| %>
<%= f.label :content %>
<%= f.text_area :content, rows: 6 %>
<%f.submit 'Save' %>
and in new.html.erb
<h1> New Booking </h1>
<%= render 'form' %>
and the end result: NoMethodError in Bookings#new appears.
(PS this question is a bit off-topic but how would I go in making a form input for selecting a TO and FROM date (in order of month:day:year)?
It appears you don't haven't migrated your model, so it only has an id and timestamps. Just create a new migration (or edit the existing if you don't mind resetting the db, but it isn't a good practice).
Run in terminal:
rails generate migration AddContentToBookings content:text
and then
rake db:migrate
Be sure to check out Rails Migration Guide
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.