1
votes

Added the convert_options code to existing Paperclip code in my user method. Now getting:

/Users/-----/----/-------/app/models/user.rb:148: syntax error, unexpected tASSOC, expecting keyword_end :convert_options => { :small => '-quality 40' }

What am I missing?

User Model:

...
 # Paperclip
  has_attached_file :photo, 
        :styles => {
          :small => ["50x50#", :jpeg],
           :big => ["450x450#", :jpeg]
         }     

        :convert_options => { 
          :small => '-quality 40' 
         }         

        validates_attachment_size :photo, :less_than => 5.megabytes
        validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png']
...
2

2 Answers

4
votes

You're missing a comma after your :styles => {...}.

0
votes
has_attached_file :photo, 
                  :styles => {
                              :small => ["50x50#", :jpeg],
                              :big => ["450x450#", :jpeg]
                             }, 
                  :convert_options => { 
                                       :small => '-quality 40' 
                                      } 

I know that it's a lot of indenting but it helps me when I try to debug some thing. Some editors highlight opening brackets with closing ones. It can also help.