0
我按照如何添加多個回形針上傳使用嵌套的屬性,這似乎很好地工作,但是我現在有一個問題,我不能編輯記錄的教程任何現有記錄或添加任何新的。但我可以通過編輯表單將照片上傳到現有記錄。多回形針上傳了創紀錄的新的突破和編輯功能
在編輯或保存一個新的記錄應用重定向,但沒有一個領域的內容保存,所以一個新的記錄將與所有領域的零和編輯的更改保存記錄保存沒有。
場館模型
class Venue < ActiveRecord::Base
attr_accessible :venuephotos_attributes
belongs_to :area
belongs_to :venuetype
has_many :reviews
has_many :venuephotos
accepts_nested_attributes_for :venuephotos, :allow_destroy => true
scope :with_type, lambda { |types|
types.present? ? where(:venuetype_id => types) : scoped }
scope :with_area, lambda { |areas|
areas.present? ? where(:area_id => areas) : scoped }
def to_param
"#{id}-#{name.gsub(/\W/, '-').downcase}"
end
end
如果我刪除attr_accessible:venuephotos_attributes行新的和編輯頁面重新工作。
感謝您的幫助!