Sha256: eaba0b24a9306849121556b686ac78c50b4ea60444743a0a766941f7d0865ebd
Contents?: true
Size: 925 Bytes
Versions: 14
Compression:
Stored size: 925 Bytes
Contents
module Spree module Api class ImagesController < Spree::Api::BaseController def show @image = Image.accessible_by(current_ability, :read).find(params[:id]) respond_with(@image) end def create authorize! :create, Image @image = Image.create(image_params) respond_with(@image, :status => 201, :default_template => :show) end def update @image = Image.accessible_by(current_ability, :update).find(params[:id]) @image.update_attributes(image_params) respond_with(@image, :default_template => :show) end def destroy @image = Image.accessible_by(current_ability, :destroy).find(params[:id]) @image.destroy respond_with(@image, :status => 204) end private def image_params params.require(:image).permit(permitted_image_attributes) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems