Method: AttachmentMagick::ImagesController#create

Defined in:
app/controllers/attachment_magick/images_controller.rb

#createObject



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
  options = {
    :photo      => params[:Filedata],
    :source     => params[:source],
    :file_name  => (params[:Filedata].original_filename unless params[:source])
  }

  @image = @klass.images.create(options)
  @klass.save

  partial_options = {
    :collection => [@image],
    :as         => :image,
    :partial    => AttachmentMagick.configuration.default_add_partial
  }

  partial_options.merge!({:partial => params[:data_partial]}) if params[:data_partial].present?
  render partial_options
end