trabajo-afectivo/app/controllers/ticket_priorities_controller.rb

48 lines
1.1 KiB
Ruby
Raw Normal View History

2012-04-10 14:06:46 +00:00
class TicketPrioritiesController < ApplicationController
before_filter :authentication_check
# GET /ticket_priorities
def index
@ticket_priorities = Ticket::Priority.all
render :json => @ticket_priorities
2012-04-10 14:06:46 +00:00
end
# GET /ticket_priorities/1
def show
@ticket_priority = Ticket::Priority.find(params[:id])
render :json => @ticket_priority
2012-04-10 14:06:46 +00:00
end
# POST /ticket_priorities
def create
@ticket_priority = Ticket::Priority.new(params[:ticket_priority])
if @ticket_priority.save
render :json => @ticket_priority, :status => :created
else
render :json => @ticket_priority.errors, :status => :unprocessable_entity
2012-04-10 14:06:46 +00:00
end
end
# PUT /ticket_priorities/1
def update
@ticket_priority = Ticket::Priority.find(params[:id])
if @ticket_priority.update_attributes(params[:ticket_priority])
render :json => @ticket_priority, :status => :ok
else
render :json => @ticket_priority.errors, :status => :unprocessable_entity
2012-04-10 14:06:46 +00:00
end
end
# DELETE /ticket_priorities/1
def destroy
@ticket_priority = Ticket::Priority.find(params[:id])
@ticket_priority.destroy
head :ok
2012-04-10 14:06:46 +00:00
end
end