Very green question here. I built a simple blog following the instructions here http://guides.rubyonrails.org/getting_started.html
How can I add another string variable to the post object?
Once I have a new variable, how do I create new posts in html.erb files? The code below gives me a NoMethodError exception for the ’email’ method. How do I make this code run without an error?
btw – what is convention on stackoverflow for followup questions?
<h2>Add a post:</h2>
<%= form_for([@post, @post.actions.build]) do |f| %>
<div class="field">
<%= f.label :number_performed %><br />
<%= f.text_field :number %>
</div>
<div class="field">
<%= f.label :your_email %><br />
<%= f.text_field :email %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
At the very least to get the minimum functionality, you must add another column to your post table.
See here on how to add a column programitcally:
http://api.rubyonrails.org/classes/ActiveRecord/Migration.html
OR you can run the rails generate migration command like so:
No matter what route you go down, make sure you run the following to apply those migrations to your database:
From there you can access: