I have set up my models to use a polymorphic Image model. This is working fine, however I am wondering if it is possible to change the :styles setting for each model. Found some
class Banner < ActiveRecord::Base
belongs_to :banner_categoria
validates :banner_categoria_id ,{:presence =>{:message => "não informada"}}
has_attached_file :arquivo
after_initialize :init_attachment
def init_attachment
self.class.has_attached_file :arquivo,
:url => "/system/:class/:attachment/:id/:style/:basename.:extension",
:path => ":rails_root/public/system/:class/:attachment/:id/:style/:basename.:extension",
:styles => hash = {
:banner => {
:geometry => "#{self.banner_categoria.largura}x#{self.banner_categoria.altura}>",
:quality => 80
},
:thumb => "100x100#"
}
end
end