You can also use carrierwavegem
Add to your Gemfile: gem 'carrierwave'
Run bundle install
Create a bootloader to download the video using the carrier generator.
rails g uploader video
Creates a file video_uploader.rbin a directoryuploaders
, , , add_{column}_to_{model}
rails g migration add_video_to_post video:string
rake db:migrate
class Post < ActiveRecord::Base
mount_uploader :video, VideoUploader
end
PostController
class PostController < ApplicationController
.
.
.
def post_params
params.require(:post).permit(:name,:video)
end
end
_forml.html.erb, views/posts
<%=f.file_field :video%>
/
<% @posts.each do |post|%>
<%= post.name %>
<%= video_tag post.video_url.to_s :controls =>true %>
<%end%>
https://github.com/carrierwaveuploader/carrierwave
http://railscasts.com/episodes/253-carrierwave-file-uploads