How to save a paperclip attachement from the params hash?

I'm trying to create an instance of my CompanyLogo model if the hash params[:vacancy]['companies']['company_logo'] is pressent. I'm attempting to do this:

l = :company_logo => params[:vacancy]['companies']['company_logo'].tempfile.path )

but that gives me

CompanyLogo(#70304040244500) expected, got ActionDispatch::Http::UploadedFile(#70304015073440)

Is there a way to do this?


If your CompanyLogo has_attached :logo,and you are saving file manually then simply company_logo_object.logo = and solve your purpose

Try saving the logo first (tested in Rails 3.2.2 using Paperclip)

(logo = => params[:image])).save

company_object.update_attributes(logo: logo)

Need Your Help

How can I deploy an upgrade of my product which contains a file with version lower than the already deployed file?

deployment wix windows-installer versioning major-upgrade

I have a msi component which deploys a file MyFile.dll. I have a test machine in which my product already deployed MyFile.dll, which has version