ruby - Rails 4 - Route error for video_tag -


in rails 4.2.4, using paperclip gem video file uploads. after uploads video file, getting 1 route error while displaying it.

no route matches [get] "/videos/user_1/3/sample.webm" 

actual file path /home/shruthi/projects/test/videos/user_1/3/sample.webm

below lines added config/application.rb

config.assets.enabled = true config.assets.paths << "#{rails.root}/videos" 

in model,

has_attached_file :document, :path => "#{rails.root}/videos/:user_id/:event_id/:basename.:extension", :url => "/videos/:user_id/:event_id/:basename.:extension", :storage => :filesystem  validates_attachment_presence :document validates_attachment :document, :content_type=>{:content_type=>/^(video\/(mp4|avi|mpeg|ogg|quicktime|webm|x-matroska|x-ms-wmv|x-flv|3gpp))/}, :size => { :less_than =>5.megabytes } validates :event, :presence=>true 

in views,

<%= video_tag video.document.url, type: video.document_content_type %> 

please tell me how can display video file?


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -