Skip to content

Instantly share code, notes, and snippets.

@coderforhire
Created January 26, 2012 23:03
Show Gist options
  • Save coderforhire/1685692 to your computer and use it in GitHub Desktop.
Save coderforhire/1685692 to your computer and use it in GitHub Desktop.
<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
@coderforhire
Copy link
Author

wrong number of arguments (0 for 1)
Rails.root: /home/afresta/rails_projects/Newground-Intranet

Application Trace | Framework Trace | Full Trace
app/models/ticket.rb:19:in set_status' app/controllers/tickets_controller.rb:65:inblock in update'
app/controllers/tickets_controller.rb:64:in `update'
Request

Parameters:

{"_method"=>"put",
"authenticity_token"=>"+tSED76jx53qwXHvJgY2MEepDBL+Da+EqQfEicoRpHg=",
"status"=>"closed",
"id"=>"8"}
Show session dump

Show env dump

Response

Headers:

None

@coderforhire
Copy link
Author

def set_status(status)
self.status = status
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment