Class: MoPage::ImagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/mo_page/images_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



5
6
7
8
9
10
11
12
13
# File 'app/controllers/mo_page/images_controller.rb', line 5

def create
  params.permit :imgFile, :localUrl, :dir, :authenticity_token
  image = Image.new(file: params[:imgFile])
  if image.save
    render json: {'error' => 0, 'url' => image.file.url}
  else
    render json: {'error' => 1, 'message' => "error"}
  end
end