Class: CatsController
Instance Attribute Summary
#params, #req, #res
Instance Method Summary
collapse
#already_built_response?, #controller_name, #initialize, #invoke_action, #redirect_to, #render, #render_content, #session
Constructor Details
This class inherits a constructor from ControllerBase
Instance Method Details
#create ⇒ Object
20
21
22
23
24
25
|
# File 'app/controllers/cats_controller.rb', line 20
def create
@cat = Cat.new
@cat.name = params['cat']['name']
@cat.save
render :show
end
|
#index ⇒ Object
6
7
8
9
|
# File 'app/controllers/cats_controller.rb', line 6
def index
@cats = Cat.all
render :index
end
|
#new ⇒ Object
16
17
18
|
# File 'app/controllers/cats_controller.rb', line 16
def new
render :new
end
|
#show ⇒ Object
11
12
13
14
|
# File 'app/controllers/cats_controller.rb', line 11
def show
@cat = Cat.find(Integer(params['cat_id']))
render :show
end
|