在我的Rails 4的應用程序中,有五款車型: class User < ActiveRecord::Base
has_many :administrations
has_many :calendars, through: :administrations
end
class Calendar < ActiveRecord::Base
has_many :adm
我正在構建一個在兩個對象下面創建/嵌套的對象的Rails應用程序。 的routes.rb resources :pages do
resources :referralpages do
resources :rewards do
end
end
end
我剛加入的獎勵資源,有此爲我的表單創建一個新的獎勵 <%= form_for ([@re
在我的Rails 4應用程序,我有以下型號: class User < ActiveRecord::Base
has_many :administrations, dependent: :destroy
has_many :calendars, through: :administrations
end
class Administration < ActiveRecor
我無法找到的東西,會在正確的方向引導。其他人對嵌套資源的類似問題似乎在解決accepts_nested_attributes_for&hellip;這並不是我想要做的。我並沒有試圖從父母那裏拯救孩子,我試圖直接從孩子那裏拯救。 在我的routes.rb,我嵌套我的資源 resources :parents, param: :parent do
resources :children, p
在我的routes.rb文件我有以下資源: resources :educations do
resources :semesters do
resources :module_assignments do
resources :module_exams do
resources :module_marks
end
end
我想保留我的嵌套資源在其父項的上下文中。這裏是我的代碼如下: 的routes.rb: resources :categories do
resources :subcategories
end
遷移: create_table "categories" do |t|
t.string "name"
end
create_table "subcategories" d