Class: CatsController

Inherits:
Reloj::ControllerBase show all
Defined in:
lib/reloj/skeletons/old_example/app/controllers/cats_controller.rb

Instance Attribute Summary

Attributes inherited from Reloj::ControllerBase

#params, #req, #res

Instance Method Summary collapse

Methods inherited from Reloj::ControllerBase

#already_built_response?, #flash, #initialize, #invoke_action, #redirect_to, #render, #render_content, #session

Methods included from RouteHelper

included

Constructor Details

This class inherits a constructor from Reloj::ControllerBase

Instance Method Details

#createObject



3
4
5
6
7
8
9
10
# File 'lib/reloj/skeletons/old_example/app/controllers/cats_controller.rb', line 3

def create
  @cat = Cat.new(params["cat"])
  if @cat.save
    redirect_to("/cats")
  else
    render :new
  end
end

#indexObject



12
13
14
15
16
17
# File 'lib/reloj/skeletons/old_example/app/controllers/cats_controller.rb', line 12

def index
  session['count'] ||= 0
  session['count'] += 1
  @cats = Cat.all
  render :index
end

#newObject



19
20
21
22
# File 'lib/reloj/skeletons/old_example/app/controllers/cats_controller.rb', line 19

def new
  @cat = Cat.new
  render :new
end