Class: Sail::SettingsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/sail/settings_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
# File 'app/controllers/sail/settings_controller.rb', line 5

def index
  @settings = Setting.by_name(params[:query]).paginated(index_params[:page])
  fresh_when(@settings)
end

#showObject



18
19
20
21
22
23
24
25
# File 'app/controllers/sail/settings_controller.rb', line 18

def show
  respond_to do |format|
    format.json do
      setting = Sail::Setting.get(params[:name])
      render json: { value: setting }
    end
  end
end

#updateObject



10
11
12
13
14
15
16
# File 'app/controllers/sail/settings_controller.rb', line 10

def update
  respond_to do |format|
    @setting, @successful_update = Setting.set(params[:name], params[:value])
    format.js {}
    format.json { @successful_update ? head(:ok) : head(:conflict) }
  end
end