2012-09-13 2 views
1

브랜드 많은 이미지는 내 연관입니다. 이미지 클립을중첩 된 양식은 rails_admin에서 작동하지 않습니다

에서 레일 관리자를 사용하여, 나는 내가 브랜드를

class Brand < ActiveRecord:Base 
    has_many :images, as=> :imageable 
end 

class Image < ActiveRecord:Base 
    attr_accessor :image_thumb 
    attr_accessible :image, :imageable_id, :imageable_type, :image_thumb 
    has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" } 
    belongs_to :imageable, :polymorphic => true 
end 

를 추가 할 때 이미지를 추가 할 그러나 이것은 내가 어떻게 내를 달성 할 수

enter image description here

을 얻을 것입니다 골?

답변

2

나는

class Brand < ActiveRecord::Base 
    attr_accessible :name, :images_attributes 
    has_many :products 
    has_many :images, :as => :imageable 
    accepts_nested_attributes_for :images, :allow_destroy => true 
end 
+1

attr_accessible은 더 이상 사용되지 않으므로 이제 Rails 4에서이 문제가 해결 되었습니까? – chourobin

+0

havent 아직 시도 : – codeAnand

+1

내가 할 ... accepts_nested_attributes 및 attr_accessible하지만 레일 관리에 중첩 된 모델을 표시하지 않습니다 !! 표시 버튼은 새 인스턴스 만 추가 !!! 어떻게해야합니까!? –

0

을 attr_accessible 추가해야합니다 그리고 당신은 사용자 acts_as_taggable, 당신의 rails_admin.rb 설정 파일에 다음 코드를 추가 할 때 솔루션입니다 :

field :tag_list do 
    label "Tag" 
end 

또는 'image_list를' 당신이 사용하는 것에 달려 있습니다.

관련 문제