Skip to content

Instantly share code, notes, and snippets.

@urielhdz
Created March 17, 2015 03:12
Show Gist options
  • Save urielhdz/dba98dfb9aec70156718 to your computer and use it in GitHub Desktop.
Save urielhdz/dba98dfb9aec70156718 to your computer and use it in GitHub Desktop.
Upload video to GCS using Fog and PaperClip
module HasVideoConcern
extend ActiveSupport::Concern
included do
has_attached_file :mp4_video_file,
:storage => :fog,
:fog_credentials => {
provider: 'Google',
google_storage_access_key_id: '',
google_storage_secret_access_key: ''
},
:fog_directory => ""
validates_attachment_content_type :mp4_video_file,
:content_type => ["video/mp4", "application/mp4", "audio/mp4","video/vnd.objectvideo","video/mp4","video/mpeg4-generic"]
has_attached_file :webm_video_file,
:storage => :fog,
:fog_credentials => {
provider: 'Google',
google_storage_access_key_id: '',
google_storage_secret_access_key: ''
},
:fog_directory => ""
validates_attachment_content_type :webm_video_file, :content_type => 'video/webm'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment