Friday, April 24, 2009

Week 11: Rails Passion Course

  1. Week 11: Action Controller Basics (Action Controllers are the core of a web request in Rails. They are made up of one or more actions that are executed on request and then either render a template or redirect to another action. An action is defined as a public method on the controller, which will automatically be made accessible to the web-server through Rails Routes.
    Topics to be covered: What is ActionController?, ActionController classes, Request handling, Parameters, Session & Flash, Rendering, Redirection, Classic problem of user refresh & redirection, Routing (request mapping))
  2. 5526_rails_controller.zip (Unzip it in a directory of your choice and read lab document from /rails_controller/index.html to proceed) (4/24/09: Downloaded)
  3. Week 11 Resources
    o Basics
    + Action Pack from api.rubyonrails.org
    + ActionController::Base API from api.rubyonrails.org
    + ActionController::Flash API from api.rubyonrails.org
    o Routing
    + ActionController::Routing API from api.rubyonrails.org
    o Caching
    + ActionController::Caching API from api.rubyonrails.org
  4. Presentation - PDF: 1 slide per page (OR) OpenOffice file (47 pages) (4/27/2009: Done)
  5. Online Lab document/Change Log (This is the same document you will find in the hands-on lab zip file) (93 pages)
  6. EXERCISE 0: Start MySQL database server. (p.2)
  7. EXERCISE 1: Requests and Parameters I (p.2-15)
  8. (1.0) Open and run "helloworld" sample application (p.2-4)
  9. (1.1) Observe parameters in development log. (p.4-6)
  10. (1.2) Modify the controller (p.6-9)
  11. (1.3) Pass the parameters through URL (p.9-11)
  12. (1.4) Observe the parameters in development log (p.11-12)
  13. (1.5) Observe the controller and action parameters (p.12-16) PROBLEM: :action not displayed. The fix was to rename ":action_name" to ":action1_name"
  14. EXERCISE 2: Request and Parameters II (p.16-34)
  15. (2.0) Open and run "helloname" sample application project. (p.16-19)
  16. (2.1)Observe parameters in development log. (p.19-22)
  17. (2.2) Study how user input data is collected as parameters (p.22-25)
  18. (2.3) Study how parameters are accessed in the controller (p.25-26)
  19. (2.4) Add another column to the table through migration (p.26-30)
  20. (2.5) Modify the code of index.html.erb and respond.html.erb files. (p.30-31)
  21. (2.6) Run the helloname application. (p.31-33)
  22. (2.7) Observe the parameters in development log. (p.33-34)
  23. EXERCISE 3: Session and Flash (p.34-63)
  24. (3.1) Use session. (p.34-40)
  25. (3.2) Use ActiveRecordStore to maintain session data (p.40-56)
  26. (3.3) Use Flash (p.56-63)
  27. EXERCISE 4: Rendering (p.63-72)
  28. (4.1) Use render :text (p.64-66)
  29. (4.2) Use render :action => :respond (p.66-68)
  30. (4.3) Use render :action => 'respond" (p.68-70)
  31. (4.4) Use render :template (p.70-72)
  32. EXERCISE #5: User refresh problem with "render" - Use "redirect_to" (p.72-87)
  33. (5.1) Observe the problem of using render :action=>'list' when a user press "Refresh" (p.73-80)
  34. (5.2) Correct the problem by using redirect :action=>'list' instead (p.80-87)
  35. EXERCISE #6: Routing Basics (p.87-
  36. (6.1) Use Rails Console (for routing experimentation) (p.87-88)
  37. (6.2) Named routes (p.88-92)
  38. Homework


No comments:

Post a Comment