Saturday, 17 August 2013

Rails Admin not taking "where condition" in consideration

Rails Admin not taking "where condition" in consideration

I have following model
class X < ActiveRecord::Base
has_many :ys, :as => :content, :class_name => "Y", :dependent =>
:destroy, :conditions => {"images.category" => "new_category"}
end
Class Y < ActiveRecord::Base
attr_accessible :file
has_attached_file :file, :styles => { :medium => "300x300>", :thumb =>
"100x100>", :big => "600x600>" }
end
Now when using rails admin I am uploading image from X model, it is taking
care of polymorphic feilds, but it is not taking care of condition
specified in relation, the record created has category as NULL.
Thanks

No comments:

Post a Comment