我想此刻紅寶石 - 未初始化的恆定誤差
我已經得到了以下學習Ruby,但無法弄清楚,爲什麼我得到(上Item.new
)未初始化的恆定誤差。任何人都可以將我指向正確的方向嗎?
編輯澄清這是使用「Simple_form」寶石。它已經捆綁安裝
我一直在使用它的形式如下:
<%= simple_form_for @item do |f| %>
<%= f.input :title, label: "Item" %>
<%= f.input :description %>
<%= f.button :submit %>
<% end %>
和項目控制器如下
class ItemsController < ApplicationController
def index
end
def new
@item = Item.new
end
def create
end
end
你可以在你的'rails console'中檢查'Item.first'嗎? – ashvin
您是否定義了「Item」?那麼,你是否加載它? – falsetru
ashvin - 是「rails Item.first」如果是這樣說「不知道如何構建任務」Item.first「..... –