Skip to content

Instantly share code, notes, and snippets.

@julesfern
Created December 11, 2008 15:35
Show Gist options
  • Select an option

  • Save julesfern/34748 to your computer and use it in GitHub Desktop.

Select an option

Save julesfern/34748 to your computer and use it in GitHub Desktop.
~ Cannot load /Users/danski/Sites/beatthebanker.dev/app/controllers/cases.rb because of syntax error: /Users/danski/Sites/beatthebanker.dev/app/controllers/cases.rb:28: syntax error, unexpected kCASE, expecting ')'
def create(case)
^
/Users/danski/Sites/beatthebanker.dev/app/controllers/cases.rb:29: syntax error, unexpected ')', expecting kELSE or kWHEN
/Users/danski/Sites/beatthebanker.dev/app/controllers/cases.rb:38: syntax error, unexpected kCASE
def update(id, case)
^
/Users/danski/Sites/beatthebanker.dev/app/controllers/cases.rb:41: syntax error, unexpected ')', expecting kELSE or kWHEN
/Users/danski/Sites/beatthebanker.dev/app/controllers/cases.rb:43: syntax error, unexpected kELSE, expecting $end
class Cases < Application
# provides :xml, :yaml, :js
def index
@cases = Case.all
display @cases
end
def show(id)
@case = Case.get(id)
raise NotFound unless @case
display @case
end
def new
only_provides :html
@case = Case.new
display @case
end
def edit(id)
only_provides :html
@case = Case.get(id)
raise NotFound unless @case
display @case
end
def create(case)
@case = Case.new(case)
if @case.save
redirect resource(@case), :message => {:notice => "Case was successfully created"}
else
message[:error] = "Case failed to be created"
render :new
end
end
def update(id, case)
@case = Case.get(id)
raise NotFound unless @case
if @case.update_attributes(case)
redirect resource(@case)
else
display @case, :edit
end
end
def destroy(id)
@case = Case.get(id)
raise NotFound unless @case
if @case.destroy
redirect resource(:cases)
else
raise InternalServerError
end
end
end # Cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment