0

Rails 3 でエンジンを作成しています。また、次のようなレシピを含む generic_recipe があります。

module EdibleRecipe
  class GenericRecipe < ActiveRecord::Base
    attr_accessible :recipe, :recipe_attributes, ....
    has_many :recipes
    accepts_nested_attributes_for :recipes 
  end
end

フォームは次のように正しくレンダリングされます。

<%= f.fields_for :recipe do |r| %>
...

しかし、保存すると、次のようになります。

ActiveRecord::UnknownAttributeError in EdibleRecipe::GenericRecipesController#create

完全なコードはこちらです。どんな助けでも大歓迎です:)

4

1 に答える 1

0

使用する

attr_accessible :recipes_attributes

:recipe_attributes の代わりに

于 2013-03-29T08:59:49.030 に答える