Class: AttachmentMagick::ImagesController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- AttachmentMagick::ImagesController
- Defined in:
- app/controllers/attachment_magick/images_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/attachment_magick/images_controller.rb', line 6 def create = { :photo => params[:Filedata], :source => params[:source], :file_name => (params[:Filedata].original_filename unless params[:source]) } @image = @klass.images.create() @klass.save = { :collection => [@image], :as => :image, :partial => AttachmentMagick.configuration.default_add_partial } .merge!({:partial => params[:data_partial]}) if params[:data_partial].present? render end |
#destroy ⇒ Object
35 36 37 38 39 |
# File 'app/controllers/attachment_magick/images_controller.rb', line 35 def destroy @klass.images.find(params[:id]).destroy render :text => "ok" end |
#update_sortable ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/controllers/attachment_magick/images_controller.rb', line 26 def update_sortable hsh = {} params[:images].each_with_index {|id, index| hsh.merge!({"#{index}" => {:id => "#{id}", :priority => index}}) } @klass.images_attributes = hsh @klass.save render :text => "ok" end |