-
add the cloudinary and attachinary Rails 4 gems
gem 'cloudinary'
gem 'attachinary', git: 'git://github.com/rochers/attachinary.git', branch: 'rails4'
require "attachinary/orm/active_record" in config/application.rb
1b. add the cloudinary.yml file
genarate from cloudinary.com or use from other same account project
.yml file must have staging section
-
create the database for the gem
- rake attachinary:install:migrations
- rake db:migrate
-
add attachinary ot the routes fill
- mount Attachinary::Engine => "/attachinary"
-
last line of header file Head
- <%= cloudinary_js_config %>
-
add to the model where needed
- has_attachment :photo
-
add the attachinary file uploader to the view
- <%= f.attachinary_file_field :photo %>
-
download the jquery files via rake task
- rake attachinary:fetch_fileupload
-
add the javascript files for upload etc
- //= require jquery.ui.widget
- //= require jquery.iframe-transport
- //= require jquery.fileupload
- //= require cloudinary/jquery.cloudinary
- //= require attachinary
-
add this on document ready to javascript
$('.attachinary-input').attachinary()