2012-04-10 14:06:46 +00:00
|
|
|
class SettingsController < ApplicationController
|
|
|
|
before_filter :authentication_check
|
|
|
|
|
|
|
|
# GET /settings
|
|
|
|
def index
|
|
|
|
@settings = Setting.all
|
|
|
|
|
2012-04-12 11:27:01 +00:00
|
|
|
render :json => @settings
|
2012-04-10 14:06:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# GET /settings/1
|
|
|
|
def show
|
|
|
|
@setting = Setting.find(params[:id])
|
|
|
|
|
2012-04-12 11:27:01 +00:00
|
|
|
render :json => @setting
|
2012-04-10 14:06:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# POST /settings
|
|
|
|
def create
|
|
|
|
@setting = Setting.new(params[:setting])
|
|
|
|
|
2012-04-12 11:27:01 +00:00
|
|
|
if @setting.save
|
|
|
|
render :json => @setting, :status => :created
|
|
|
|
else
|
|
|
|
render :json => @setting.errors, :status => :unprocessable_entity
|
2012-04-10 14:06:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# PUT /settings/1
|
|
|
|
def update
|
|
|
|
@setting = Setting.find(params[:id])
|
|
|
|
|
2012-04-12 11:27:01 +00:00
|
|
|
if @setting.update_attributes(params[:setting])
|
|
|
|
render :json => @setting, :status => :ok
|
|
|
|
else
|
|
|
|
render :json => @setting.errors, :status => :unprocessable_entity
|
2012-04-10 14:06:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# DELETE /settings/1
|
|
|
|
def destroy
|
|
|
|
@setting = Setting.find(params[:id])
|
|
|
|
@setting.destroy
|
|
|
|
|
2012-04-12 11:27:01 +00:00
|
|
|
head :ok
|
2012-04-10 14:06:46 +00:00
|
|
|
end
|
|
|
|
end
|