Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

20120121 rbc rails_routing

2,139 views

Published on

Published in: Technology
  • Be the first to comment

20120121 rbc rails_routing

  1. 1. Rails3.1RailsGuides Routing2012/01/21 @akimatter
  2. 2. RBC @akimatter https://github.com/akm Ruby/Rails 6 http://d.hatena.ne.jp/akm/
  3. 3. agendaEC URLREST REST HTTP Rails RESTHandsOn RailsGuides config/routes.rb Rails
  4. 4. ECURL
  5. 5. EC /
  6. 6. REST
  7. 7. REST
  8. 8. RESTRepresentational State Transfer“REST ( ) REST 2 ”http://ja.wikipedia.org/wiki/REST AWS API
  9. 9. REST URLURLURL HTTP
  10. 10. REST GETDELETE PUTPOST http://www.infoq.com/jp/articles/designing- restful-http-apps-roth
  11. 11. HTTP
  12. 12. HTTPChrome developer tool GET POST
  13. 13. HTTPRFC2616 9http://www.studyinghttp.net/cgi-bin/rfc.cgi?2616#Sec9 GET, POST OPTIONS, HEAD, PUT, DELETE, TRACE, CONNECT GET, HEAD, POST
  14. 14. http://www.studyinghttp.net/cgi-bin/rfc.cgi?2616#Sec9.1.1 GET HEAD
  15. 15. {idempotent}http://ja.forvo.com/word/idempotent/“http://www.studyinghttp.net/cgi-bin/rfc.cgi?2616#Sec9.1.2
  16. 16. “ :idempotence 1 ”http://ja.wikipedia.org/wiki/
  17. 17. IDDB OK
  18. 18. Rails REST
  19. 19. RESTful scaffold RESTful RESTful URLrake routes
  20. 20. scaffold index .all new .new create .new #save show .find(:id) edit .find(:id) update .find(:id) #save destroy .find(:id) #destroy
  21. 21. URL users Rails1.x Rails2.0 RESTful URL RESTful URL/users/index GET /users index/users/new GET /users/new new/users/create POST /users create/users/show/:id GET /users/:id show/users/edit/:id GET /users/:id/edit edit/users/update/:id PUT /users/:id update/users/destroy/:id DELETE /users/:id destroy :id ID
  22. 22. HandsOnRailsGuides
  23. 23. Rails Routing from the Outside In ruby/rails/RailsGuides /RailsRouting from the Outside In
  24. 24. #1rails rails new < > rake routes
  25. 25. #2rails generate scaffold < >< 1>:< > < 2>:< > ... rails g scaffold Photo image_path:string size:integer
  26. 26. #3DB rake db:migrate rails server rails c
  27. 27. HandsOnconfig/routes.rb
  28. 28. config/routes.rb
  29. 29. HandsOnrails
  30. 30. config/routes.rb

×