trabajo-afectivo/app/controllers/settings_controller.rb

48 lines
933 B
Ruby
Raw Normal View History

2012-04-10 14:06:46 +00:00
class SettingsController < ApplicationController
before_filter :authentication_check
# GET /settings
def index
@settings = Setting.all
render :json => @settings
2012-04-10 14:06:46 +00:00
end
# GET /settings/1
def show
@setting = Setting.find(params[:id])
render :json => @setting
2012-04-10 14:06:46 +00:00
end
# POST /settings
def create
@setting = Setting.new(params[:setting])
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])
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
head :ok
2012-04-10 14:06:46 +00:00
end
end