ruby - paperclip No handler found for "file.jpg" rails 4 -


i'm having problem setting paperclip gem in 1 of me apps.
no handler found for error message when try save uploaded file things i've done
migration:

add_attachment :orders, :file   

model:

has_attached_file :file   validates_attachment_content_type :file, :content_type => /\aimage\/.*\z/ 

controller:

def order_params     params.require(:order).permit(:file) 

view:

form_tag url, method: :post, html: {multipart: true}     ...     = file_field_tag 'order[file]', disabled: true, id: 'mtd_file',accept: 'image/png,image/gif,image/jpeg' 

when try execute in controller order.create params[order] error no handler found "file.jpg"

when order[file] param see it's string file.jpg (name of uploaded file)
can me ? i'm doing wrong ?

try using below line of code, don't have pass mulitpart html hash

`form_tag url, method: :post, multipart: true` 

for form_for have pass multipart in html hash

form_for(@user), :html => { :multipart => true } |f| 

for more info, can refer below docs

link


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -