Using Paperclip 3.0.1 in rails 3.2.2 I got this error:
**Paperclip::AdapterRegistry::NoHandlerError**
(No handler found for "2009-11-29-133527.jpg"):
In my model I have:
class Product < ActiveRecord::Base
...
has_many :assets
accepts_nested_attributes_for :assets
end
class Asset < ActiveRecord::Base
belongs_to :product
has_attached_file :image,
:path => ":rails_root/public/system/:attachment/:id/:style/:filename",
:url => "/system/:attachment/:id/:style/:filename",
:styles => { :medium => "300x300>", :thumb => "100x100>" }
end
The exception is raised at:
def create
**@product = Product.new params[:product]**
...
end
with params:
{...,
"product"=>{"title"=>"wibble1",
**"assets_attributes"=>{"0"=>{"image"=>"2009-11-29-133527.jpg"}
},**
"description"=>"Who is wibble...",
"price"=>"23.45"
},
"commit"=>"Create Product",
...}
Anyone know what's going on?
This Error is raised because you aren't giving Paperclip a correct class. It's a just a String.
You should receive something like this in
params
And you should have something like this in yout View (in HAML, very simplified):
Remember to set your form to
multipart: true
.I just ran into this problem myself. In my case it was caused by skipping the multipart form declaration in the markup.
I was using formtastic so I added this and got it working:
semantic_form_for @picture, :html => {:multipart => true} do |f|
I have met the same problem, I think it is because there are two tables sharing the same
attached_file_name
... In my case, I add a:photo
column both to activities and tweets, then the case seems to be that the system can find one of them but not the other. Because the files are saved in/public/photo/:id/:id
path, if you have two columns both named asphoto
, then the problem occurs I think.I'm pretty sure your problem is with the form_for in the view, try something like this:
my problem was not accepting get method in routes so i changed it as patch method and it work fine.
for me the problem was like this:
I used such line in controller, as saw it in some answers:
and I had the problem "no handler for the file"
so, I just removed "path" and it worked: