Rails3 no.2

  • Terminal 起動
  • $ cd rails3
  • $ rails new sample
    • 割愛
  • $ cd sample/
  • $ rails server
  • $ open http://localhost:3000/
  • "control" + c
  • $ rails generate controller main
    • 割愛
  • $ vim app/controllers/main_controller.rb

class MainController < ApplicationController


 def hello
 end


 def bye
 end


end

  • $ vim app/views/main/hello.html.erb


 
  hello
 
 
  

こんにちは

 

  • $ vim app/views/main/bye.html.erb


 
  bye
 
 
  

さよなら

 

  • $ vim config/routes.rb
    • comment deletion

 match ':controller(/:action(/:id(.:format)))'