Is there any way to generate different image styles based on models in paperclip with polymorphic association.
I have
Picture Model:
class Picture
.....
belongs_to :imageable, :polymorphic=>true
has_attached_file :local_image,
:styles => lambda{ |f|
['image/jpeg', 'image/jpg','image/png', 'image/gif'].include?(f.content_type) ? {
:thumb => "40x40>",
:small => "115x115>",
:medium => '300x300>',
:large => "500x500>" } : {}
}
...
end
User Model:
class User
has_many :pictures, :as=> :imageable
end
Group Model:
class Group
has_many :pictures, :as=> :imageable
end
I want thumb,small sizes only for user model and medium,large sizes only for group model. I have tried this https://leomayleomay.github.io/blog/2013/07/30/polymorphic-image-styles-using-paperclip/ but it does not work for new pictures, only works for existing pictures