Created
January 26, 2012 23:03
-
-
Save coderforhire/1685692 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<td><%= button_to 'Close', ticket_path(ticket), :status => 'closed', :method =>"put", :class => "btn danger" %></td> | |
def set_status(status) | |
if status == 'closed' | |
self.status = 'closed' | |
else | |
self.status = 'open' | |
end | |
end | |
def update | |
@ticket = Ticket.find(params[:id]) | |
respond_to do |format| | |
if @ticket.update_attributes(params[:ticket]) | |
format.html { redirect_to tickets_open_path, notice: 'Ticket was successfully updated.' } | |
format.json { head :no_content } | |
else | |
format.html { render action: "edit" } | |
format.json { render json: @ticket.errors, status: :unprocessable_entity } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
def set_status(status)
self.status = status
end