Class: Mercury::ImagesController

Inherits:
MercuryController
  • Object
show all
Defined in:
app/controller/mercury/images_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /images.json



6
7
8
9
10
11
12
13
14
15
# File 'app/controller/mercury/images_controller.rb', line 6

def create
  
  @image = Mercury::Image.new
  @image.size = "300x300"
  @image.size = params[:size] if params[:size] and !params[:size].empty?
  @image.image = params.require(:image).permit(:image)[:image]
  
  @image.save
  respond_with @image
end

#destroyObject

DELETE /images/1.json



18
19
20
21
22
# File 'app/controller/mercury/images_controller.rb', line 18

def destroy
  @image = Mercury::Image.find(params[:id])
  @image.destroy
  respond_with @image
end