Sha256: 1daa464462daed9ce19e037264fb97a233647320ae324bb5485f0c8666e42ade

Contents?: true

Size: 723 Bytes

Versions: 3

Compression:

Stored size: 723 Bytes

Contents

module Simplec
  module EmbeddedImageActions
    module ClassMethods; end

    module InstanceMethods

			def create
				@embedded_image = EmbeddedImage.new(embedded_image_params)
				if @embedded_image.save
					respond_to do |format|
						format.json {
							render :show, status: 201, location: @embedded_image.url
						}
					end
				else
					respond_to do |format|
						format.json {
							render status: 422, json: @embedded_image.errors
						}
					end
				end
			end

			private

			def embedded_image_params
				params.permit(:asset_url, :asset_name)
			end

    end

    def self.included(receiver)
      receiver.extend         ClassMethods
      receiver.send :include, InstanceMethods
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simplec-0.2.0 lib/simplec/embedded_image_actions.rb
simplec-0.1.2 lib/simplec/embedded_image_actions.rb
simplec-0.1.0 lib/simplec/embedded_image_actions.rb