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
和我的意見/家庭/索引/ html.erb形式添加項目Rails的錯誤 「預期... model.rb定義模式」
<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>
如何定義Item
?
位於localhost:3000,我得到
預計/Users/user/Desktop/test/app/models/item.rb定義項目
提取的源(左右線#3):