Learning Rails

1,556 views

Published on

Published in: Technology
3 Comments
8 Likes
Statistics
Notes
No Downloads
Views
Total views
1,556
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
89
Comments
3
Likes
8
Embeds 0
No embeds

No notes for slide

Learning Rails

  1. 1. * * splash@dei.uc.pt 31  March  2011  
  2. 2. Chapter 0
  3. 3. def  what  is  rails?      A  web  framework  end
  4. 4. Rails was created in 2003by David Heinemeier Hansson
  5. 5. Who is already on Rails?
  6. 6. Who is already on Rails?
  7. 7. Who is already on Rails?
  8. 8. Who is already on Rails?
  9. 9. Let’s try it out!
  10. 10. Let’s try it out!
  11. 11. Let’s try it out!
  12. 12. Chapter 1
  13. 13. Basic concepts of Rails§  Support for§  Follows the pattern §  Follows the architectural pattern §  Supports
  14. 14. Rails directory structure
  15. 15. Rails directory structure
  16. 16. Rails directory structure Application code, structured following the MVC design
  17. 17. Rails directory structure Application configuration
  18. 18. Rails directory structure
  19. 19. Rails directory structure
  20. 20. Rails directory structure
  21. 21. Rails directory structure Files to manipulate the database
  22. 22. Rails directory structure Documentation for the app
  23. 23. Rails directory structure Static files accessible to the public
  24. 24. Rails directory structure Application tests
  25. 25. Rails directory structure Third-party Plugins
  26. 26. Rails directory structure
  27. 27. Bundler next step Use Bundler to include and install the gems needed
  28. 28. Bundler
  29. 29. Bundler
  30. 30. Chapter 2
  31. 31. Building a simple app Key id integer value string state string
  32. 32. Building a simple app
  33. 33. Building a simple app
  34. 34. Building a simple app
  35. 35. Building a simple app
  36. 36. Building a simple app§  We now need to§  This with our new data model
  37. 37. Building a simple app§  Let’s delete the default static page
  38. 38. Building a simple app§  Run the server!
  39. 39. Building a simple app§  Root page
  40. 40. Building a simple app§  Index action
  41. 41. Building a simple app§  New action
  42. 42. Building a simple app§  Show action
  43. 43. Building a simple app§  Edit action
  44. 44. Building a simple app§  Destroy
  45. 45. Building a simple app table from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  Correspondence between pages and URLs
  46. 46. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in Rails
  47. 47. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in Rails The browser issues a request for the URL
  48. 48. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in RailsRails routesto the indexaction in the
  49. 49. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in Rails the !
  50. 50. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in Rails
  51. 51. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in Rails The index action asks the Key model to retrieve all keys ( )
  52. 52. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in Rails The Key model pulls all the keys from the database
  53. 53. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in Rails The Key model returns the list of keys to the controller
  54. 54. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in RailsThe controller capturesthe keys in the @keysvariable, which is passedto the
  55. 55. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in RailsThe controller capturesthe keys in the @usersvariable, which is passedto the
  56. 56. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in RailsThe controller capturesthe keys in the @usersvariable, which is passedto the
  57. 57. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in Rails The view uses embedded Ruby to render the page as HTML
  58. 58. Building a simple app diagram from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  MVC in Rails The controller passes the HTML back to the browser
  59. 59. Building a simple app§  Where are defined the routes?
  60. 60. Building a simple app§  Which are the default actions?
  61. 61. Building a simple app table from “Ruby on Rails Tutorial: Learn Rails by Example” available at http://ruby.railstutorial.org/§  RESTful routes
  62. 62. image downloaded from http://wallpaperof.net/retro/
  63. 63. Chapter 4
  64. 64. Simple validations
  65. 65. Simple validations I shouldn’t be able to create a key without or
  66. 66. Simple validations V alue should be unique
  67. 67. Simple validations
  68. 68. Simple validations
  69. 69. Simple validations
  70. 70. Simple validations
  71. 71. Simple validations
  72. 72. Simple validations
  73. 73. Simple validations
  74. 74. Form helpers & builders
  75. 75. Form helpers & builders
  76. 76. Form helpers & builders
  77. 77. Form helpers & builders
  78. 78. Form helpers & builders
  79. 79. Form helpers & builders
  80. 80. Form helpers & builders§  Let’s try a Form Builder DSL
  81. 81. Form helpers & builders§  Let’s try a Form Builder DSL - Features
  82. 82. Form helpers & builders§  Let’s try a Form Builder DSL - Features
  83. 83. Form helpers & builders§  Let’s try a Form Builder DSL - Installation
  84. 84. Form helpers & builders§  Let’s try a Form Builder DSL - Installation
  85. 85. Form helpers & builders§  Let’s try a Form Builder DSL - Installation
  86. 86. Form helpers & builders§  Let’s try a Form Builder DSL - Installation
  87. 87. Form helpers & builders§  Let’s try a Form Builder DSL - Installation
  88. 88. Form helpers & builders§  Let’s try a Form Builder DSL - Installation
  89. 89. Form helpers & builders§  Let’s try a Form Builder DSL - Installation
  90. 90. Form helpers & builders§  Let’s try a Form Builder DSL - Installation
  91. 91. Form helpers & builders§  Let’s try a Form Builder DSL - Installation
  92. 92. Form helpers & builders§  Let’s try a Form Builder DSL - Installation
  93. 93. Form helpers & builders§  Let’s try it out!
  94. 94. Form helpers & builders§  Let’s try it out!
  95. 95. Form helpers & builders§  Let’s try it out!
  96. 96. Alternate markup languages
  97. 97. Alternate markup languages§  Why do views tend to become more and more complex?
  98. 98. Alternate markup languages HTML
  99. 99. Alternate markup languages
  100. 100. Alternate markup languages
  101. 101. Alternate markup languages
  102. 102. Alternate markup languages
  103. 103. Alternate markup languages
  104. 104. Alternate markup languages
  105. 105. Alternate markup languages
  106. 106. Alternate markup languages
  107. 107. Alternate markup languages
  108. 108. Alternate markup languages
  109. 109. Alternate markup languages
  110. 110. Alternate markup languages
  111. 111. Alternate markup languages
  112. 112. Root path
  113. 113. Root path
  114. 114. Root path
  115. 115. Root path
  116. 116. Root path
  117. 117. Root path
  118. 118. Root path
  119. 119. image downloaded from http://wallpaperof.net/retro/
  120. 120. Chapter 5
  121. 121. Adding tournaments
  122. 122. Adding tournaments Tournament has many Key key_id integer name string start_date string end_date string
  123. 123. Adding tournaments
  124. 124. Adding tournaments
  125. 125. Adding tournaments
  126. 126. Adding tournaments
  127. 127. Adding tournaments
  128. 128. Adding tournaments
  129. 129. Adding tournaments
  130. 130. Adding tournaments
  131. 131. Adding tournaments
  132. 132. Adding tournaments
  133. 133. Adding tournaments
  134. 134. Adding tournaments
  135. 135. Adding tournaments
  136. 136. Adding tournaments
  137. 137. Adding tournaments
  138. 138. Adding tournaments
  139. 139. Adding tournaments
  140. 140. Adding value range to states
  141. 141. Adding value range to states
  142. 142. Adding value range to states
  143. 143. Adding value range to states
  144. 144. Adding value range to states
  145. 145. Adding value range to states
  146. 146. Adding value range to states
  147. 147. Adding value range to states
  148. 148. Adding value range to states
  149. 149. Internationalization & localization image downloaded from http://wallpaperof.net/retro/
  150. 150. Internationalization & localization
  151. 151. Internationalization & localization
  152. 152. Internationalization & localization
  153. 153. Internationalization & localization
  154. 154. Internationalization & localization
  155. 155. Internationalization & localization
  156. 156. Internationalization & localization
  157. 157. Internationalization & localization
  158. 158. Route translation
  159. 159. Route translation
  160. 160. Route translation
  161. 161. Route translation
  162. 162. Route translation
  163. 163. Route translation
  164. 164. Route translation
  165. 165. Route translation
  166. 166. Route translation
  167. 167. Route translation
  168. 168. Route translation
  169. 169. Route translation
  170. 170. Route translation
  171. 171. Route translation
  172. 172. Route translation
  173. 173. Chapter 6
  174. 174. Web-app-theme
  175. 175. Web-app-theme
  176. 176. Web-app-theme
  177. 177. Web-app-theme
  178. 178. Web-app-theme
  179. 179. Web-app-theme
  180. 180. Chapter 7
  181. 181. Create a button on the keys’ indexpage to generate 100 random keys
  182. 182. Create a button on the keys’ index page to generate 100 random keys hints
  183. 183. Create a button on the keys’ indexpage to generate 100 random keys
  184. 184. Create a button on the keys’ indexpage to generate 100 random keys
  185. 185. Create a button on the keys’ indexpage to generate 100 random keys
  186. 186. Create a button on the keys’ indexpage to generate 100 random keys
  187. 187. The end
  188. 188. The end
  189. 189. Give back!
  190. 190. Give back! open source projects, feedback, share your knowledge, your snippets & projects
  191. 191. * * splash@dei.uc.pt 31  March  2011  

×