0
我在Rails 4上玩RailsAdmin。而且我有非常簡單的情況(兩個模型,Event屬於Idea)。RailsAdmin沒有正確處理belongs_to
代碼:
class Idea < ActiveRecord::Base
end
class Event < ActiveRecord::Base
belongs_to :idea
end
模式
create_table "events", force: true do |t|
t.string "location"
t.integer "idea_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "events", ["idea_id"], name: "index_events_on_idea_id"
create_table "ideas", force: true do |t|
t.string "title"
t.text "descrption"
t.datetime "created_at"
t.datetime "updated_at"
end
而且我看到這一點。我不知道爲什麼它會顯示下拉選擇想法和額外的數字編輯框?
。
您需要在兩個模型上映射關係,如'idea has_many events'。 –
@Damien:謝謝。有用。你可以把它作爲答案張貼,所以我可以接受它。 –
太棒了!當然,會做的。 –