Paperclip stuck in model at has_attached_file after upgrading from Rails 2.3.5 to Rails 3.1.3

106 views
Skip to first unread message

Shailesh Kalamkar

unread,
Apr 18, 2012, 7:40:12 AM4/18/12
to Paperclip Plugin
I have upgraded my application from Rails 2.3.5 to Rails 3.1.3. I had
paperclip plug-in in my old app. I have added paperclip gem in Gemfile
as

gem 'paperclip', :git => 'http://github.com/thoughtbot/paperclip.git'

I have model code as

class Mugshot < ActiveRecord::Base
belongs_to :mugshotable, :polymorphic => true

attr_accessible :photo


Paperclip.interpolates :mugshotable_type do |attachment, style|
attachment.instance.mugshotable_type.downcase
end


has_attached_file :photo,
:styles => { :thumb=> "128x128#" },
:default_style => :thumb,
:use_timestamp => false,
:url => "/system/
images/:mugshotable_type/:id/:style/:basename.:extension",
:path => ":rails_root/public/system/
images/:mugshotable_type/:id/:style/:basename.:extension"

end
Application get stuck at model with log as

app/models/mugshot.rb:12:in `<class:Mugshot>' #line where
has_attached_file called
app/models/mugshot.rb:1:in `<top (required)>'



I have upgraded my application from Rails 2.3.5 to Rails 3.1.3. I had
paperclip plug-in in my old app. I have added paperclip gem in Gemfile
as

gem 'paperclip', :git => 'http://github.com/thoughtbot/paperclip.git'

I have model code as

class Mugshot < ActiveRecord::Base
belongs_to :mugshotable, :polymorphic => true

attr_accessible :photo


Paperclip.interpolates :mugshotable_type do |attachment, style|
attachment.instance.mugshotable_type.downcase
end


has_attached_file :photo,
:styles => { :thumb=> "128x128#" },
:default_style => :thumb,
:use_timestamp => false,
:url => "/system/
images/:mugshotable_type/:id/:style/:basename.:extension",
:path => ":rails_root/public/system/
images/:mugshotable_type/:id/:style/:basename.:extension"

end

Application get stuck at model with log as

app/models/mugshot.rb:12:in `<class:Mugshot>' #line where
has_attached_file called
app/models/mugshot.rb:1:in `<top (required)>'

Please help me out. I am really stucked.

EDITED

After removing silencer I got log as follows

activemodel (3.1.3) lib/active_model/validations/with.rb:83:in `block
in validates_with'
activemodel (3.1.3) lib/active_model/validations/with.rb:81:in `each'
activemodel (3.1.3) lib/active_model/validations/with.rb:81:in
`validates_with'
activemodel (3.1.3) lib/active_model/validations.rb:88:in
`validates_each'
/Users/shailesh/.rvm/gems/ruby-1.9.2-p290/bundler/gems/
paperclip-8390516f435f/lib/paperclip.rb:193:in `has_attached_file'
app/models/mugshot.rb:12:in `<class:Mugshot>'
app/models/mugshot.rb:1:in `<top (required)>'
activesupport (3.1.3) lib/active_support/dependencies.rb:456:in `load'
activesupport (3.1.3) lib/active_support/dependencies.rb:456:in `block
in load_file'
activesupport (3.1.3) lib/active_support/dependencies.rb:640:in
`new_constants_in'

Please help me out.

Thanks in advance
Reply all
Reply to author
Forward
0 new messages