Class: ActiveadminSettings::PicturesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/activeadmin_settings/pictures_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/activeadmin_settings/pictures_controller.rb', line 9

def create
  @picture = ActiveadminSettings::Picture.new
  @picture.data = params[:file]

  if @picture.save
    render :json => { :filelink => @picture.url }
  else
    render :nothing => true
  end
end

#indexObject



4
5
6
7
# File 'app/controllers/activeadmin_settings/pictures_controller.rb', line 4

def index
  @pictures = ActiveadminSettings::Picture.all
  render :json => @pictures
end