Rails Carrierwave Video Uploader

非 Y 不嫁゛ 提交于 2019-12-13 21:05:43

问题


Im using carrierwave with my Rails 4 app.

I have two uploaders installed - one for avatar and one for video. I use both of them in my projects model. My project.rb file has:

mount_uploader :hero_image, AvatarUploader
  mount_uploader :link_to_video_proposal, VideoUploader

My project controller includes:

params.require(:project).permit(:link_to_video_proposal)

My project _form has:

  <%=f.file_field :link_to_video_proposal%>

My project show page has:

     <%= video_tag @project.link_to_video_proposal_url.to_s :controls =>true %>

I have tried to follow the example in the 7 step answer in this post Upload Video in a rails application (but changed the video tag from post.video to @project.link_to_video_proposal

When I save this and test it, I get an error that says:

wrong number of arguments (1 for 0) (referring to the line in my show page).

Can anyone see what I have done wrong?

Thank you


回答1:


I've solved the problem with adding if micropost.video?..

<%= video_tag micropost.video_url.to_s :controls =>true if micropost.video?%>


来源:https://stackoverflow.com/questions/29464524/rails-carrierwave-video-uploader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!