Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.
brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus| #Make sure heroku toolbelt and rvm are installed | |
| #heroku toolbelt available to download on their site, rvm available via curl | |
| \curl -sSL https://get.rvm.io | bash -s stable --ruby | |
| rvm use "2.1.1" | |
| rvm use --create 2.1.1@project | |
| gem install rails | |
| #if using postgres (good for heroku) pass argument to 'rails new' | |
| rails new project --database=postgresql |
| require 'aws-sdk' | |
| s3 = Aws::S3::Resource.new( | |
| region: 'us-east-1', | |
| credentials: Aws::InstanceProfileCredentials.new() | |
| ) | |
| bucket = s3.bucket('my-daily-backups') | |
| file = (DateTime.now).strftime("%Y.%m.%d-backup") | |
| if bucket.object(file).exists? |
| sudo -i | |
| cd | |
| apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y | |
| wget http://www.imagemagick.org/download/ImageMagick-6.8.7-7.tar.gz | |
| tar xzvf ImageMagick-6.8.9-1.tar.gz | |
| cd ImageMagick-6.8.9-1/ | |
| ./configure --prefix=/opt/imagemagick-6.8 && make | |
| checkinstall |
It's pretty easy to do polymorphic associations in Rails: A Picture can belong to either a BlogPost or an Article. But what if you need the relationship the other way around? A Picture, a Text and a Video can belong to an Article, and that article can find all media by calling @article.media
This example shows how to create an ArticleElement join model that handles the polymorphic relationship. To add fields that are common to all polymorphic models, add fields to the join model.