# Paperclip polymorphic styles problem

**URL:** <https://www.ruby-forum.com/t/paperclip-polymorphic-styles-problem/191235>\
**Category:** Rails\
**Created:** [July 7, 2010, 10:57pm UTC](https://www.ruby-forum.com/t/paperclip-polymorphic-styles-problem/191235 "2010-07-07T22:57:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dries](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8e8cbc/32.png) [@dries](https://www.ruby-forum.com/u/dries)\
**Post date:** [July 7, 2010, 10:57pm UTC](https://www.ruby-forum.com/t/paperclip-polymorphic-styles-problem/191235/1 "2010-07-07T22:57:25Z")

</div>

I made my model Picture polymorphic and this model use paperclip. Now I  
want to specify :styles for the model that have many pictures, but I  
can’t find a solution to fix this. At the moment I use this and all is  
working good :

[http://pastie.org/1034105](http://pastie.org/1034105)

But for example for model Brand I need different styles then for model  
Product.

I tried a lambda like this :

:styles =\> lambda{|data| data.instance.picturable.attachment\_styles}

But that is not a solution because it seems that link between the model  
is not set when firing submit, he first do has\_attached\_file stuff and  
then the inserting in the database, it means that showing the objects is  
no problem but creating. He doesn’t know the object jet, you can find  
console output here :

[http://pastie.org/1034667](http://pastie.org/1034667)
