9. Try Ruby!
Http://tryruby.org
Stop when you see
"summary 4" or stuff
about file operations.
Skip to challenge on
Classes.
10. Ruby, Ruby, Ruby
● Everything is an object
● Chain methods to your heart's content
●
Bang! Or no bang?
● Hashes and :symbols
● Key value pairs :key => 'value'
●
Blocks { } / do end
● @instance variables
17. Rails has generated
●
Application defaults, files and settings
●
A model to represent the 'Station' entity
●
A database table to store stations
●
A controller to respond to requests
●
Views to show them
18. Rails has generated
●
Application defaults, files and settings
●
A model to represent the 'Station' entity
rails new firstfm
●
A database table to store stations
●
A controller to respond to requests
●
Views to show them
19. Rails has generated
●
Application defaults, files and settings
●
A model to represent the 'Station' entity
●
A database table to store stations
●
A controller to respond to requests
●
Views to show them
rails generate scaffold Station name:string
description:text url:string
20. Rails has generated
●
Application defaults, files and settings
●
A model to represent the 'Station' entity
●
A database table to store stations
●
A controller to respond to requests
●
Views to show them
rake db:migrate
28. CRUD actions in the controller
●
Create – new, create
● Read – index, show
● Update – edit, update
●
Destroy - destroy
29. The 'Show' Action (Controller)
# GET /stations/1
# GET /stations/1.json
def show
@station = Station.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @station }
end
end