Sha256: b551d8e1c93d1add9138042e0bbb9c11b7892b20e0854ae25732e424ec6c72fc
Contents?: true
Size: 1.92 KB
Versions: 3
Compression:
Stored size: 1.92 KB
Contents
## Installation Add this line to your application's Gemfile: gem 'uploadify_rails' And then execute: $ bundle ## Usage Migration (Photo work with Paperclip): create_table :photos do |t| t.integer :advert_id # объявление t.integer :user_id # пользователь (авторизованный) t.string :session_id # пользователь (гость) t.string :data_content_type t.string :data_file_name t.integer :data_file_size t.timestamps end Routes: resources :photos, :only => [:create] post "/photo/:id" => "photos#destroy" Javascripts: //= require uploadify Stylesheets: *= require uploadify Model Parent (F.E. Advert): class Advert ... ... has_many :photos, :dependent => :destroy accepts_nested_attributes_for :photos, :allow_destroy => true ... # Support only one relation name in just moment uploadify_nested_parent :relations => [:photos] ... Model with Photo: class Photo ... uploadify_nested_resource Photos Controller: class PhotosController < ApplicationController uploadify_nested_resource end Adverts Controller: class AdvertsController < ApplicationController ... def create @advert = Advert.new @advert.build_attributes_from_params(params, current_user, session[:session_id]) if @advert.save ... View: Example: in app/views/shared/uploadify/... Formtastic Form Integration (@advert form): = form.input :photos, :as => :uploadify ## Enjoy! ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request ## Thanks Thanks to https://github.com/dead-zygote for javascripts and first time realization
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
uploadify_rails-0.0.15 | README.md |
uploadify_rails-0.0.14 | README.md |
uploadify_rails-0.0.12 | README.md |