class ItemController < ApplicationController
def create
item = current_user.items.build(params[:presentstem])
item.created_at = Time.now
item.save!
redirect_to root_path
end
def destroy
end
end
And my form in views/home/index/html.erb to add an item
<div id="add_item">
<p>Add a new item</p>
<% form_for Item.new do |f| %>
<div id="add_item_container">
<%= f.text_field :present %>
<%= f.text_field :stem %>
<%= f.text_field :secondary %>
<%= f.check_box :atype %>
<%= f.text_field :comment %>
</div>
<%= f.submit "Add to List" %>
<% end %>
</div>
How do I define Item?
at localhost:3000 I get
Expected /Users/user/Desktop/test/app/models/item.rb to define Item
Extracted source (around line #3):
You should have Item class definition in this file
/Users/user/Desktop/test/app/models/item.rb, probably you don’t…