openskies 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (494) hide show
  1. data/CHANGELOG.md +87 -0
  2. data/README.rdoc +35 -0
  3. data/bin/openskies +9 -0
  4. data/guides/assets/images/belongs_to.png +0 -0
  5. data/guides/assets/images/book_icon.gif +0 -0
  6. data/guides/assets/images/bullet.gif +0 -0
  7. data/guides/assets/images/challenge.png +0 -0
  8. data/guides/assets/images/chapters_icon.gif +0 -0
  9. data/guides/assets/images/check_bullet.gif +0 -0
  10. data/guides/assets/images/credits_pic_blank.gif +0 -0
  11. data/guides/assets/images/csrf.png +0 -0
  12. data/guides/assets/images/customized_error_messages.png +0 -0
  13. data/guides/assets/images/edge_badge.png +0 -0
  14. data/guides/assets/images/error_messages.png +0 -0
  15. data/guides/assets/images/feature_tile.gif +0 -0
  16. data/guides/assets/images/footer_tile.gif +0 -0
  17. data/guides/assets/images/fxn.png +0 -0
  18. data/guides/assets/images/grey_bullet.gif +0 -0
  19. data/guides/assets/images/habtm.png +0 -0
  20. data/guides/assets/images/has_many.png +0 -0
  21. data/guides/assets/images/has_many_through.png +0 -0
  22. data/guides/assets/images/has_one.png +0 -0
  23. data/guides/assets/images/has_one_through.png +0 -0
  24. data/guides/assets/images/header_backdrop.png +0 -0
  25. data/guides/assets/images/header_tile.gif +0 -0
  26. data/guides/assets/images/i18n/demo_html_safe.png +0 -0
  27. data/guides/assets/images/i18n/demo_localized_pirate.png +0 -0
  28. data/guides/assets/images/i18n/demo_translated_en.png +0 -0
  29. data/guides/assets/images/i18n/demo_translated_pirate.png +0 -0
  30. data/guides/assets/images/i18n/demo_translation_missing.png +0 -0
  31. data/guides/assets/images/i18n/demo_untranslated.png +0 -0
  32. data/guides/assets/images/icons/README +5 -0
  33. data/guides/assets/images/icons/callouts/1.png +0 -0
  34. data/guides/assets/images/icons/callouts/10.png +0 -0
  35. data/guides/assets/images/icons/callouts/11.png +0 -0
  36. data/guides/assets/images/icons/callouts/12.png +0 -0
  37. data/guides/assets/images/icons/callouts/13.png +0 -0
  38. data/guides/assets/images/icons/callouts/14.png +0 -0
  39. data/guides/assets/images/icons/callouts/15.png +0 -0
  40. data/guides/assets/images/icons/callouts/2.png +0 -0
  41. data/guides/assets/images/icons/callouts/3.png +0 -0
  42. data/guides/assets/images/icons/callouts/4.png +0 -0
  43. data/guides/assets/images/icons/callouts/5.png +0 -0
  44. data/guides/assets/images/icons/callouts/6.png +0 -0
  45. data/guides/assets/images/icons/callouts/7.png +0 -0
  46. data/guides/assets/images/icons/callouts/8.png +0 -0
  47. data/guides/assets/images/icons/callouts/9.png +0 -0
  48. data/guides/assets/images/icons/caution.png +0 -0
  49. data/guides/assets/images/icons/example.png +0 -0
  50. data/guides/assets/images/icons/home.png +0 -0
  51. data/guides/assets/images/icons/important.png +0 -0
  52. data/guides/assets/images/icons/next.png +0 -0
  53. data/guides/assets/images/icons/note.png +0 -0
  54. data/guides/assets/images/icons/prev.png +0 -0
  55. data/guides/assets/images/icons/tip.png +0 -0
  56. data/guides/assets/images/icons/up.png +0 -0
  57. data/guides/assets/images/icons/warning.png +0 -0
  58. data/guides/assets/images/jaimeiniesta.jpg +0 -0
  59. data/guides/assets/images/nav_arrow.gif +0 -0
  60. data/guides/assets/images/polymorphic.png +0 -0
  61. data/guides/assets/images/posts_index.png +0 -0
  62. data/guides/assets/images/radar.png +0 -0
  63. data/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
  64. data/guides/assets/images/rails_guides_logo.gif +0 -0
  65. data/guides/assets/images/rails_logo_remix.gif +0 -0
  66. data/guides/assets/images/rails_welcome.png +0 -0
  67. data/guides/assets/images/session_fixation.png +0 -0
  68. data/guides/assets/images/tab_grey.gif +0 -0
  69. data/guides/assets/images/tab_info.gif +0 -0
  70. data/guides/assets/images/tab_note.gif +0 -0
  71. data/guides/assets/images/tab_red.gif +0 -0
  72. data/guides/assets/images/tab_yellow.gif +0 -0
  73. data/guides/assets/images/tab_yellow.png +0 -0
  74. data/guides/assets/images/validation_error_messages.png +0 -0
  75. data/guides/assets/images/vijaydev.jpg +0 -0
  76. data/guides/assets/javascripts/guides.js +7 -0
  77. data/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
  78. data/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
  79. data/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
  80. data/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
  81. data/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
  82. data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
  83. data/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
  84. data/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
  85. data/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
  86. data/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
  87. data/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
  88. data/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
  89. data/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
  90. data/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
  91. data/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
  92. data/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
  93. data/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
  94. data/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
  95. data/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
  96. data/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
  97. data/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
  98. data/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
  99. data/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
  100. data/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
  101. data/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
  102. data/guides/assets/javascripts/syntaxhighlighter/shCore.js +17 -0
  103. data/guides/assets/stylesheets/fixes.css +16 -0
  104. data/guides/assets/stylesheets/kindle.css +11 -0
  105. data/guides/assets/stylesheets/main.css +453 -0
  106. data/guides/assets/stylesheets/print.css +52 -0
  107. data/guides/assets/stylesheets/reset.css +43 -0
  108. data/guides/assets/stylesheets/style.css +13 -0
  109. data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +226 -0
  110. data/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
  111. data/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
  112. data/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
  113. data/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
  114. data/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
  115. data/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
  116. data/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
  117. data/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
  118. data/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
  119. data/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
  120. data/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
  121. data/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
  122. data/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
  123. data/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
  124. data/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
  125. data/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
  126. data/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
  127. data/guides/code/getting_started/Gemfile +38 -0
  128. data/guides/code/getting_started/README.rdoc +261 -0
  129. data/guides/code/getting_started/Rakefile +7 -0
  130. data/guides/code/getting_started/app/assets/images/rails.png +0 -0
  131. data/guides/code/getting_started/app/assets/javascripts/application.js +15 -0
  132. data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +3 -0
  133. data/guides/code/getting_started/app/assets/javascripts/home.js.coffee +3 -0
  134. data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +3 -0
  135. data/guides/code/getting_started/app/assets/stylesheets/application.css +13 -0
  136. data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +3 -0
  137. data/guides/code/getting_started/app/assets/stylesheets/home.css.scss +3 -0
  138. data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +3 -0
  139. data/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss +56 -0
  140. data/guides/code/getting_started/app/controllers/application_controller.rb +3 -0
  141. data/guides/code/getting_started/app/controllers/comments_controller.rb +16 -0
  142. data/guides/code/getting_started/app/controllers/home_controller.rb +5 -0
  143. data/guides/code/getting_started/app/controllers/posts_controller.rb +84 -0
  144. data/guides/code/getting_started/app/helpers/application_helper.rb +2 -0
  145. data/guides/code/getting_started/app/helpers/comments_helper.rb +2 -0
  146. data/guides/code/getting_started/app/helpers/home_helper.rb +2 -0
  147. data/guides/code/getting_started/app/helpers/posts_helper.rb +5 -0
  148. data/guides/code/getting_started/app/models/comment.rb +3 -0
  149. data/guides/code/getting_started/app/models/post.rb +11 -0
  150. data/guides/code/getting_started/app/models/tag.rb +3 -0
  151. data/guides/code/getting_started/app/views/comments/_comment.html.erb +15 -0
  152. data/guides/code/getting_started/app/views/comments/_form.html.erb +13 -0
  153. data/guides/code/getting_started/app/views/home/index.html.erb +2 -0
  154. data/guides/code/getting_started/app/views/layouts/application.html.erb +14 -0
  155. data/guides/code/getting_started/app/views/posts/_form.html.erb +32 -0
  156. data/guides/code/getting_started/app/views/posts/edit.html.erb +6 -0
  157. data/guides/code/getting_started/app/views/posts/index.html.erb +27 -0
  158. data/guides/code/getting_started/app/views/posts/new.html.erb +5 -0
  159. data/guides/code/getting_started/app/views/posts/show.html.erb +31 -0
  160. data/guides/code/getting_started/app/views/tags/_form.html.erb +12 -0
  161. data/guides/code/getting_started/config/application.rb +59 -0
  162. data/guides/code/getting_started/config/boot.rb +6 -0
  163. data/guides/code/getting_started/config/database.yml +25 -0
  164. data/guides/code/getting_started/config/environment.rb +5 -0
  165. data/guides/code/getting_started/config/environments/development.rb +37 -0
  166. data/guides/code/getting_started/config/environments/production.rb +67 -0
  167. data/guides/code/getting_started/config/environments/test.rb +37 -0
  168. data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +7 -0
  169. data/guides/code/getting_started/config/initializers/inflections.rb +15 -0
  170. data/guides/code/getting_started/config/initializers/mime_types.rb +5 -0
  171. data/guides/code/getting_started/config/initializers/secret_token.rb +7 -0
  172. data/guides/code/getting_started/config/initializers/session_store.rb +8 -0
  173. data/guides/code/getting_started/config/initializers/wrap_parameters.rb +14 -0
  174. data/guides/code/getting_started/config/locales/en.yml +5 -0
  175. data/guides/code/getting_started/config/routes.rb +64 -0
  176. data/guides/code/getting_started/config.ru +4 -0
  177. data/guides/code/getting_started/db/migrate/20110901012504_create_posts.rb +11 -0
  178. data/guides/code/getting_started/db/migrate/20110901012815_create_comments.rb +12 -0
  179. data/guides/code/getting_started/db/migrate/20110901013701_create_tags.rb +11 -0
  180. data/guides/code/getting_started/db/schema.rb +43 -0
  181. data/guides/code/getting_started/db/seeds.rb +7 -0
  182. data/guides/code/getting_started/doc/README_FOR_APP +2 -0
  183. data/guides/code/getting_started/public/404.html +26 -0
  184. data/guides/code/getting_started/public/422.html +26 -0
  185. data/guides/code/getting_started/public/500.html +25 -0
  186. data/guides/code/getting_started/public/favicon.ico +0 -0
  187. data/guides/code/getting_started/public/robots.txt +5 -0
  188. data/guides/code/getting_started/script/rails +6 -0
  189. data/guides/code/getting_started/test/fixtures/comments.yml +11 -0
  190. data/guides/code/getting_started/test/fixtures/posts.yml +11 -0
  191. data/guides/code/getting_started/test/fixtures/tags.yml +9 -0
  192. data/guides/code/getting_started/test/functional/comments_controller_test.rb +7 -0
  193. data/guides/code/getting_started/test/functional/home_controller_test.rb +9 -0
  194. data/guides/code/getting_started/test/functional/posts_controller_test.rb +49 -0
  195. data/guides/code/getting_started/test/performance/browsing_test.rb +12 -0
  196. data/guides/code/getting_started/test/test_helper.rb +13 -0
  197. data/guides/code/getting_started/test/unit/comment_test.rb +7 -0
  198. data/guides/code/getting_started/test/unit/helpers/comments_helper_test.rb +4 -0
  199. data/guides/code/getting_started/test/unit/helpers/home_helper_test.rb +4 -0
  200. data/guides/code/getting_started/test/unit/helpers/posts_helper_test.rb +4 -0
  201. data/guides/code/getting_started/test/unit/post_test.rb +7 -0
  202. data/guides/code/getting_started/test/unit/tag_test.rb +7 -0
  203. data/guides/rails_guides/generator.rb +310 -0
  204. data/guides/rails_guides/helpers.rb +45 -0
  205. data/guides/rails_guides/indexer.rb +69 -0
  206. data/guides/rails_guides/levenshtein.rb +31 -0
  207. data/guides/rails_guides/textile_extensions.rb +63 -0
  208. data/guides/rails_guides.rb +50 -0
  209. data/guides/source/2_2_release_notes.textile +422 -0
  210. data/guides/source/2_3_release_notes.textile +610 -0
  211. data/guides/source/3_0_release_notes.textile +595 -0
  212. data/guides/source/3_1_release_notes.textile +553 -0
  213. data/guides/source/3_2_release_notes.textile +540 -0
  214. data/guides/source/_license.html.erb +2 -0
  215. data/guides/source/_welcome.html.erb +19 -0
  216. data/guides/source/action_controller_overview.textile +820 -0
  217. data/guides/source/action_mailer_basics.textile +516 -0
  218. data/guides/source/action_view_overview.textile +1497 -0
  219. data/guides/source/active_model_basics.textile +205 -0
  220. data/guides/source/active_record_basics.textile +218 -0
  221. data/guides/source/active_record_querying.textile +1433 -0
  222. data/guides/source/active_record_validations_callbacks.textile +1283 -0
  223. data/guides/source/active_resource_basics.textile +120 -0
  224. data/guides/source/active_support_core_extensions.textile +3713 -0
  225. data/guides/source/ajax_on_rails.textile +267 -0
  226. data/guides/source/api_documentation_guidelines.textile +185 -0
  227. data/guides/source/asset_pipeline.textile +707 -0
  228. data/guides/source/association_basics.textile +1959 -0
  229. data/guides/source/caching_with_rails.textile +437 -0
  230. data/guides/source/command_line.textile +574 -0
  231. data/guides/source/configuring.textile +641 -0
  232. data/guides/source/contributing_to_ruby_on_rails.textile +448 -0
  233. data/guides/source/credits.html.erb +72 -0
  234. data/guides/source/debugging_rails_applications.textile +714 -0
  235. data/guides/source/documents.yaml +157 -0
  236. data/guides/source/engines.textile +618 -0
  237. data/guides/source/form_helpers.textile +798 -0
  238. data/guides/source/generators.textile +621 -0
  239. data/guides/source/getting_started.textile +1929 -0
  240. data/guides/source/i18n.textile +931 -0
  241. data/guides/source/index.html.erb +30 -0
  242. data/guides/source/initialization.textile +1116 -0
  243. data/guides/source/kindle/KINDLE.md +26 -0
  244. data/guides/source/kindle/copyright.html.erb +1 -0
  245. data/guides/source/kindle/layout.html.erb +27 -0
  246. data/guides/source/kindle/rails_guides.opf.erb +52 -0
  247. data/guides/source/kindle/toc.html.erb +24 -0
  248. data/guides/source/kindle/toc.ncx.erb +64 -0
  249. data/guides/source/kindle/welcome.html.erb +5 -0
  250. data/guides/source/layout.html.erb +124 -0
  251. data/guides/source/layouts_and_rendering.textile +1237 -0
  252. data/guides/source/migrations.textile +900 -0
  253. data/guides/source/nested_model_forms.textile +222 -0
  254. data/guides/source/performance_testing.textile +597 -0
  255. data/guides/source/plugins.textile +464 -0
  256. data/guides/source/rails_application_templates.textile +240 -0
  257. data/guides/source/rails_on_rack.textile +236 -0
  258. data/guides/source/routing.textile +885 -0
  259. data/guides/source/ruby_on_rails_guides_guidelines.textile +79 -0
  260. data/guides/source/security.textile +1004 -0
  261. data/guides/source/testing.textile +947 -0
  262. data/guides/w3c_validator.rb +91 -0
  263. data/lib/rails/all.rb +15 -0
  264. data/lib/rails/application/bootstrap.rb +73 -0
  265. data/lib/rails/application/configuration.rb +151 -0
  266. data/lib/rails/application/finisher.rb +98 -0
  267. data/lib/rails/application/railties.rb +13 -0
  268. data/lib/rails/application/route_inspector.rb +84 -0
  269. data/lib/rails/application/routes_reloader.rb +56 -0
  270. data/lib/rails/application.rb +320 -0
  271. data/lib/rails/backtrace_cleaner.rb +42 -0
  272. data/lib/rails/cli.rb +16 -0
  273. data/lib/rails/code_statistics.rb +118 -0
  274. data/lib/rails/commands/application.rb +38 -0
  275. data/lib/rails/commands/benchmarker.rb +34 -0
  276. data/lib/rails/commands/console.rb +55 -0
  277. data/lib/rails/commands/dbconsole.rb +123 -0
  278. data/lib/rails/commands/destroy.rb +10 -0
  279. data/lib/rails/commands/generate.rb +12 -0
  280. data/lib/rails/commands/plugin.rb +544 -0
  281. data/lib/rails/commands/plugin_new.rb +11 -0
  282. data/lib/rails/commands/profiler.rb +32 -0
  283. data/lib/rails/commands/runner.rb +54 -0
  284. data/lib/rails/commands/server.rb +100 -0
  285. data/lib/rails/commands/update.rb +9 -0
  286. data/lib/rails/commands.rb +104 -0
  287. data/lib/rails/configuration.rb +89 -0
  288. data/lib/rails/console/app.rb +36 -0
  289. data/lib/rails/console/helpers.rb +11 -0
  290. data/lib/rails/engine/commands.rb +43 -0
  291. data/lib/rails/engine/configuration.rb +84 -0
  292. data/lib/rails/engine/railties.rb +33 -0
  293. data/lib/rails/engine.rb +657 -0
  294. data/lib/rails/generators/actions.rb +325 -0
  295. data/lib/rails/generators/active_model.rb +78 -0
  296. data/lib/rails/generators/app_base.rb +281 -0
  297. data/lib/rails/generators/base.rb +390 -0
  298. data/lib/rails/generators/css/assets/assets_generator.rb +13 -0
  299. data/lib/rails/generators/css/assets/templates/stylesheet.css +4 -0
  300. data/lib/rails/generators/css/scaffold/scaffold_generator.rb +16 -0
  301. data/lib/rails/generators/erb/controller/controller_generator.rb +20 -0
  302. data/lib/rails/generators/erb/controller/templates/view.html.erb +2 -0
  303. data/lib/rails/generators/erb/mailer/mailer_generator.rb +13 -0
  304. data/lib/rails/generators/erb/mailer/templates/view.text.erb +3 -0
  305. data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +29 -0
  306. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +23 -0
  307. data/lib/rails/generators/erb/scaffold/templates/edit.html.erb +6 -0
  308. data/lib/rails/generators/erb/scaffold/templates/index.html.erb +27 -0
  309. data/lib/rails/generators/erb/scaffold/templates/new.html.erb +5 -0
  310. data/lib/rails/generators/erb/scaffold/templates/show.html.erb +12 -0
  311. data/lib/rails/generators/erb.rb +21 -0
  312. data/lib/rails/generators/generated_attribute.rb +107 -0
  313. data/lib/rails/generators/js/assets/assets_generator.rb +13 -0
  314. data/lib/rails/generators/js/assets/templates/javascript.js +2 -0
  315. data/lib/rails/generators/migration.rb +68 -0
  316. data/lib/rails/generators/named_base.rb +202 -0
  317. data/lib/rails/generators/rails/app/USAGE +15 -0
  318. data/lib/rails/generators/rails/app/app_generator.rb +303 -0
  319. data/lib/rails/generators/rails/app/templates/Gemfile +26 -0
  320. data/lib/rails/generators/rails/app/templates/README +261 -0
  321. data/lib/rails/generators/rails/app/templates/Rakefile +7 -0
  322. data/lib/rails/generators/rails/app/templates/app/assets/images/rails.png +0 -0
  323. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +17 -0
  324. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +13 -0
  325. data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb +3 -0
  326. data/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb +2 -0
  327. data/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory +0 -0
  328. data/lib/rails/generators/rails/app/templates/app/models/.empty_directory +0 -0
  329. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +14 -0
  330. data/lib/rails/generators/rails/app/templates/config/application.rb +74 -0
  331. data/lib/rails/generators/rails/app/templates/config/boot.rb +6 -0
  332. data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +31 -0
  333. data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +86 -0
  334. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +62 -0
  335. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +33 -0
  336. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +43 -0
  337. data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +20 -0
  338. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +54 -0
  339. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +39 -0
  340. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +55 -0
  341. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +25 -0
  342. data/lib/rails/generators/rails/app/templates/config/environment.rb +5 -0
  343. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +41 -0
  344. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +73 -0
  345. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +39 -0
  346. data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb +7 -0
  347. data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +15 -0
  348. data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb +5 -0
  349. data/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt +7 -0
  350. data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +8 -0
  351. data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +16 -0
  352. data/lib/rails/generators/rails/app/templates/config/locales/en.yml +5 -0
  353. data/lib/rails/generators/rails/app/templates/config/routes.rb +58 -0
  354. data/lib/rails/generators/rails/app/templates/config.ru +4 -0
  355. data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +7 -0
  356. data/lib/rails/generators/rails/app/templates/doc/README_FOR_APP +2 -0
  357. data/lib/rails/generators/rails/app/templates/gitignore +15 -0
  358. data/lib/rails/generators/rails/app/templates/public/404.html +26 -0
  359. data/lib/rails/generators/rails/app/templates/public/422.html +26 -0
  360. data/lib/rails/generators/rails/app/templates/public/500.html +25 -0
  361. data/lib/rails/generators/rails/app/templates/public/favicon.ico +0 -0
  362. data/lib/rails/generators/rails/app/templates/public/index.html +241 -0
  363. data/lib/rails/generators/rails/app/templates/public/robots.txt +5 -0
  364. data/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory +0 -0
  365. data/lib/rails/generators/rails/app/templates/script/rails +5 -0
  366. data/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory +0 -0
  367. data/lib/rails/generators/rails/app/templates/test/functional/.empty_directory +0 -0
  368. data/lib/rails/generators/rails/app/templates/test/integration/.empty_directory +0 -0
  369. data/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb +12 -0
  370. data/lib/rails/generators/rails/app/templates/test/test_helper.rb +15 -0
  371. data/lib/rails/generators/rails/app/templates/test/unit/.empty_directory +0 -0
  372. data/lib/rails/generators/rails/assets/USAGE +20 -0
  373. data/lib/rails/generators/rails/assets/assets_generator.rb +25 -0
  374. data/lib/rails/generators/rails/assets/templates/javascript.js +2 -0
  375. data/lib/rails/generators/rails/assets/templates/stylesheet.css +4 -0
  376. data/lib/rails/generators/rails/controller/USAGE +18 -0
  377. data/lib/rails/generators/rails/controller/controller_generator.rb +20 -0
  378. data/lib/rails/generators/rails/controller/templates/controller.rb +13 -0
  379. data/lib/rails/generators/rails/generator/USAGE +12 -0
  380. data/lib/rails/generators/rails/generator/generator_generator.rb +25 -0
  381. data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +3 -0
  382. data/lib/rails/generators/rails/generator/templates/USAGE.tt +8 -0
  383. data/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
  384. data/lib/rails/generators/rails/helper/USAGE +17 -0
  385. data/lib/rails/generators/rails/helper/helper_generator.rb +13 -0
  386. data/lib/rails/generators/rails/helper/templates/helper.rb +4 -0
  387. data/lib/rails/generators/rails/integration_test/USAGE +10 -0
  388. data/lib/rails/generators/rails/integration_test/integration_test_generator.rb +7 -0
  389. data/lib/rails/generators/rails/migration/USAGE +29 -0
  390. data/lib/rails/generators/rails/migration/migration_generator.rb +8 -0
  391. data/lib/rails/generators/rails/model/USAGE +45 -0
  392. data/lib/rails/generators/rails/model/model_generator.rb +8 -0
  393. data/lib/rails/generators/rails/observer/USAGE +12 -0
  394. data/lib/rails/generators/rails/observer/observer_generator.rb +7 -0
  395. data/lib/rails/generators/rails/performance_test/USAGE +10 -0
  396. data/lib/rails/generators/rails/performance_test/performance_test_generator.rb +7 -0
  397. data/lib/rails/generators/rails/plugin_new/USAGE +10 -0
  398. data/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +318 -0
  399. data/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec +29 -0
  400. data/lib/rails/generators/rails/plugin_new/templates/Gemfile +23 -0
  401. data/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE +20 -0
  402. data/lib/rails/generators/rails/plugin_new/templates/README.rdoc +3 -0
  403. data/lib/rails/generators/rails/plugin_new/templates/Rakefile +31 -0
  404. data/lib/rails/generators/rails/plugin_new/templates/app/controllers/%name%/application_controller.rb.tt +4 -0
  405. data/lib/rails/generators/rails/plugin_new/templates/app/helpers/%name%/application_helper.rb.tt +4 -0
  406. data/lib/rails/generators/rails/plugin_new/templates/app/mailers/.empty_directory +0 -0
  407. data/lib/rails/generators/rails/plugin_new/templates/app/models/.empty_directory +0 -0
  408. data/lib/rails/generators/rails/plugin_new/templates/app/views/layouts/%name%/application.html.erb.tt +14 -0
  409. data/lib/rails/generators/rails/plugin_new/templates/config/routes.rb +6 -0
  410. data/lib/rails/generators/rails/plugin_new/templates/gitignore +7 -0
  411. data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb +7 -0
  412. data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/version.rb +3 -0
  413. data/lib/rails/generators/rails/plugin_new/templates/lib/%name%.rb +6 -0
  414. data/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%name%_tasks.rake +4 -0
  415. data/lib/rails/generators/rails/plugin_new/templates/rails/application.rb +18 -0
  416. data/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb +10 -0
  417. data/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb +4 -0
  418. data/lib/rails/generators/rails/plugin_new/templates/script/rails.tt +7 -0
  419. data/lib/rails/generators/rails/plugin_new/templates/test/%name%_test.rb +7 -0
  420. data/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb +12 -0
  421. data/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb +15 -0
  422. data/lib/rails/generators/rails/resource/USAGE +23 -0
  423. data/lib/rails/generators/rails/resource/resource_generator.rb +20 -0
  424. data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +50 -0
  425. data/lib/rails/generators/rails/scaffold/USAGE +35 -0
  426. data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +23 -0
  427. data/lib/rails/generators/rails/scaffold/templates/scaffold.css +56 -0
  428. data/lib/rails/generators/rails/scaffold_controller/USAGE +19 -0
  429. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +25 -0
  430. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +89 -0
  431. data/lib/rails/generators/rails/session_migration/USAGE +8 -0
  432. data/lib/rails/generators/rails/session_migration/session_migration_generator.rb +8 -0
  433. data/lib/rails/generators/rails/task/USAGE +9 -0
  434. data/lib/rails/generators/rails/task/task_generator.rb +12 -0
  435. data/lib/rails/generators/rails/task/templates/task.rb +8 -0
  436. data/lib/rails/generators/resource_helpers.rb +80 -0
  437. data/lib/rails/generators/test_case.rb +247 -0
  438. data/lib/rails/generators/test_unit/controller/controller_generator.rb +15 -0
  439. data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +19 -0
  440. data/lib/rails/generators/test_unit/helper/helper_generator.rb +13 -0
  441. data/lib/rails/generators/test_unit/helper/templates/helper_test.rb +6 -0
  442. data/lib/rails/generators/test_unit/integration/integration_generator.rb +13 -0
  443. data/lib/rails/generators/test_unit/integration/templates/integration_test.rb +7 -0
  444. data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +14 -0
  445. data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +21 -0
  446. data/lib/rails/generators/test_unit/model/model_generator.rb +24 -0
  447. data/lib/rails/generators/test_unit/model/templates/fixtures.yml +23 -0
  448. data/lib/rails/generators/test_unit/model/templates/unit_test.rb +9 -0
  449. data/lib/rails/generators/test_unit/observer/observer_generator.rb +13 -0
  450. data/lib/rails/generators/test_unit/observer/templates/unit_test.rb +9 -0
  451. data/lib/rails/generators/test_unit/performance/performance_generator.rb +13 -0
  452. data/lib/rails/generators/test_unit/performance/templates/performance_test.rb +12 -0
  453. data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +13 -0
  454. data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +7 -0
  455. data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +3 -0
  456. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +38 -0
  457. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +51 -0
  458. data/lib/rails/generators/test_unit.rb +8 -0
  459. data/lib/rails/generators.rb +339 -0
  460. data/lib/rails/info.rb +116 -0
  461. data/lib/rails/info_controller.rb +15 -0
  462. data/lib/rails/initializable.rb +89 -0
  463. data/lib/rails/paths.rb +211 -0
  464. data/lib/rails/performance_test_help.rb +3 -0
  465. data/lib/rails/plugin.rb +92 -0
  466. data/lib/rails/rack/debugger.rb +24 -0
  467. data/lib/rails/rack/log_tailer.rb +34 -0
  468. data/lib/rails/rack/logger.rb +60 -0
  469. data/lib/rails/rack.rb +7 -0
  470. data/lib/rails/railtie/configurable.rb +35 -0
  471. data/lib/rails/railtie/configuration.rb +90 -0
  472. data/lib/rails/railtie.rb +202 -0
  473. data/lib/rails/ruby_version_check.rb +23 -0
  474. data/lib/rails/rubyprof_ext.rb +35 -0
  475. data/lib/rails/script_rails_loader.rb +29 -0
  476. data/lib/rails/source_annotation_extractor.rb +104 -0
  477. data/lib/rails/tasks/annotations.rake +20 -0
  478. data/lib/rails/tasks/documentation.rake +155 -0
  479. data/lib/rails/tasks/engine.rake +72 -0
  480. data/lib/rails/tasks/framework.rake +76 -0
  481. data/lib/rails/tasks/log.rake +9 -0
  482. data/lib/rails/tasks/middleware.rake +7 -0
  483. data/lib/rails/tasks/misc.rake +67 -0
  484. data/lib/rails/tasks/routes.rake +9 -0
  485. data/lib/rails/tasks/statistics.rake +16 -0
  486. data/lib/rails/tasks/tmp.rake +37 -0
  487. data/lib/rails/tasks.rb +16 -0
  488. data/lib/rails/test_help.rb +56 -0
  489. data/lib/rails/test_unit/railtie.rb +15 -0
  490. data/lib/rails/test_unit/sub_test_task.rb +8 -0
  491. data/lib/rails/test_unit/testing.rake +146 -0
  492. data/lib/rails/version.rb +10 -0
  493. data/lib/rails.rb +126 -0
  494. metadata +609 -0
@@ -0,0 +1,707 @@
1
+ h2. Asset Pipeline
2
+
3
+ This guide covers the asset pipeline introduced in Rails 3.1.
4
+ By referring to this guide you will be able to:
5
+
6
+ * Understand what the asset pipeline is and what it does
7
+ * Properly organize your application assets
8
+ * Understand the benefits of the asset pipeline
9
+ * Add a pre-processor to the pipeline
10
+ * Package assets with a gem
11
+
12
+ endprologue.
13
+
14
+ h3. What is the Asset Pipeline?
15
+
16
+ The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages such as CoffeeScript, Sass and ERB.
17
+
18
+ Prior to Rails 3.1 these features were added through third-party Ruby libraries such as Jammit and Sprockets. Rails 3.1 is integrated with Sprockets through Action Pack which depends on the +sprockets+ gem, by default.
19
+
20
+ Making the asset pipeline a core feature of Rails means that all developers can benefit from the power of having their assets pre-processed, compressed and minified by one central library, Sprockets. This is part of Rails' "fast by default" strategy as outlined by DHH in his keynote at RailsConf 2011.
21
+
22
+ In Rails 3.1, the asset pipeline is enabled by default. It can be disabled in +config/application.rb+ by putting this line inside the application class definition:
23
+
24
+ <ruby>
25
+ config.assets.enabled = false
26
+ </ruby>
27
+
28
+ You can also disable the asset pipeline while creating a new application by passing the <tt>--skip-sprockets</tt> option.
29
+
30
+ <plain>
31
+ rails new appname --skip-sprockets
32
+ </plain>
33
+
34
+ You should use the defaults for all new applications unless you have a specific reason to avoid the asset pipeline.
35
+
36
+
37
+ h4. Main Features
38
+
39
+ The first feature of the pipeline is to concatenate assets. This is important in a production environment, because it can reduce the number of requests that a browser must make to render a web page. Web browsers are limited in the number of requests that they can make in parallel, so fewer requests can mean faster loading for your application.
40
+
41
+ Rails 2.x introduced the ability to concatenate JavaScript and CSS assets by placing +:cache => true+ at the end of the +javascript_include_tag+ and +stylesheet_link_tag+ methods. But this technique has some limitations. For example, it cannot generate the caches in advance, and it is not able to transparently include assets provided by third-party libraries.
42
+
43
+ Starting with version 3.1, Rails defaults to concatenating all JavaScript files into one master +.js+ file and all CSS files into one master +.css+ file. As you'll learn later in this guide, you can customize this strategy to group files any way you like. In production, Rails inserts an MD5 fingerprint into each filename so that the file is cached by the web browser. You can invalidate the cache by altering this fingerprint, which happens automatically whenever you change the file contents..
44
+
45
+ The second feature of the asset pipeline is asset minification or compression. For CSS files, this is done by removing whitespace and comments. For JavaScript, more complex processes can be applied. You can choose from a set of built in options or specify your own.
46
+
47
+ The third feature of the asset pipeline is that it allows coding assets via a higher-level language, with precompilation down to the actual assets. Supported languages include Sass for CSS, CoffeeScript for JavaScript, and ERB for both by default.
48
+
49
+ h4. What is Fingerprinting and Why Should I Care?
50
+
51
+ Fingerprinting is a technique that makes the name of a file dependent on the contents of the file. When the file contents change, the filename is also changed. For content that is static or infrequently changed, this provides an easy way to tell whether two versions of a file are identical, even across different servers or deployment dates.
52
+
53
+ When a filename is unique and based on its content, HTTP headers can be set to encourage caches everywhere (whether at CDNs, at ISPs, in networking equipment, or in web browsers) to keep their own copy of the content. When the content is updated, the fingerprint will change. This will cause the remote clients to request a new copy of the content. This is generally known as _cache busting_.
54
+
55
+ The technique that Rails uses for fingerprinting is to insert a hash of the content into the name, usually at the end. For example a CSS file +global.css+ could be renamed with an MD5 digest of its contents:
56
+
57
+ <plain>
58
+ global-908e25f4bf641868d8683022a5b62f54.css
59
+ </plain>
60
+
61
+ This is the strategy adopted by the Rails asset pipeline.
62
+
63
+ Rails' old strategy was to append a date-based query string to every asset linked with a built-in helper. In the source the generated code looked like this:
64
+
65
+ <plain>
66
+ /stylesheets/global.css?1309495796
67
+ </plain>
68
+
69
+ The query string strategy has several disadvantages:
70
+
71
+ <ol>
72
+ <li>
73
+ <strong>Not all caches will reliably cache content where the filename only differs by query parameters</strong>.<br>
74
+ "Steve Souders recommends":http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/, "...avoiding a querystring for cacheable resources". He found that in this case 5-20% of requests will not be cached. Query strings in particular do not work at all with some CDNs for cache invalidation.
75
+ </li>
76
+ <li>
77
+ <strong>The file name can change between nodes in multi-server environments.</strong><br>
78
+ The default query string in Rails 2.x is based on the modification time of the files. When assets are deployed to a cluster, there is no guarantee that the timestamps will be the same, resulting in different values being used depending on which server handles the request.
79
+ </li>
80
+ <li>
81
+ <strong>Too much cache invalidation</strong><br />
82
+ When static assets are deployed with each new release of code, the mtime of _all_ these files changes, forcing all remote clients to fetch them again, even when the content of those assets has not changed.
83
+ </li>
84
+ </ol>
85
+
86
+ Fingerprinting fixes these problems by avoiding query strings, and by ensuring that filenames are consistent based on their content.
87
+
88
+ Fingerprinting is enabled by default for production and disabled for all other environments. You can enable or disable it in your configuration through the +config.assets.digest+ option.
89
+
90
+ More reading:
91
+
92
+ * "Optimize caching":http://code.google.com/speed/page-speed/docs/caching.html
93
+ * "Revving Filenames: don’t use querystring":http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
94
+
95
+
96
+ h3. How to Use the Asset Pipeline
97
+
98
+ In previous versions of Rails, all assets were located in subdirectories of +public+ such as +images+, +javascripts+ and +stylesheets+. With the asset pipeline, the preferred location for these assets is now the +app/assets+ directory. Files in this directory are served by the Sprockets middleware included in the sprockets gem.
99
+
100
+ Assets can still be placed in the +public+ hierarchy. Any assets under +public+ will be served as static files by the application or web server. You should use +app/assets+ for files that must undergo some pre-processing before they are served.
101
+
102
+ In production, Rails precompiles these files to +public/assets+ by default. The precompiled copies are then served as static assets by the web server. The files in +app/assets+ are never served directly in production.
103
+
104
+ When you generate a scaffold or a controller, Rails also generates a JavaScript file (or CoffeeScript file if the +coffee-rails+ gem is in the +Gemfile+) and a Cascading Style Sheet file (or SCSS file if +sass-rails+ is in the +Gemfile+) for that controller.
105
+
106
+ For example, if you generate a +ProjectsController+, Rails will also add a new file at +app/assets/javascripts/projects.js.coffee+ and another at +app/assets/stylesheets/projects.css.scss+. You should put any JavaScript or CSS unique to a controller inside their respective asset files, as these files can then be loaded just for these controllers with lines such as +<%= javascript_include_tag params[:controller] %>+ or +<%= stylesheet_link_tag params[:controller] %>+.
107
+
108
+ NOTE: You must have an "ExecJS":https://github.com/sstephenson/execjs#readme supported runtime in order to use CoffeeScript. If you are using Mac OS X or Windows you have a JavaScript runtime installed in your operating system. Check "ExecJS":https://github.com/sstephenson/execjs#readme documentation to know all supported JavaScript runtimes.
109
+
110
+ h4. Asset Organization
111
+
112
+ Pipeline assets can be placed inside an application in one of three locations: +app/assets+, +lib/assets+ or +vendor/assets+.
113
+
114
+ +app/assets+ is for assets that are owned by the application, such as custom images, JavaScript files or stylesheets.
115
+
116
+ +lib/assets+ is for your own libraries' code that doesn't really fit into the scope of the application or those libraries which are shared across applications.
117
+
118
+ +vendor/assets+ is for assets that are owned by outside entities, such as code for JavaScript plugins and CSS frameworks.
119
+
120
+ h5. Search paths
121
+
122
+ When a file is referenced from a manifest or a helper, Sprockets searches the three default asset locations for it.
123
+
124
+ The default locations are: +app/assets/images+ and the subdirectories +javascripts+ and +stylesheets+ in all three asset locations.
125
+
126
+ For example, these files:
127
+
128
+ <plain>
129
+ app/assets/javascripts/home.js
130
+ lib/assets/javascripts/moovinator.js
131
+ vendor/assets/javascripts/slider.js
132
+ </plain>
133
+
134
+ would be referenced in a manifest like this:
135
+
136
+ <plain>
137
+ //= require home
138
+ //= require moovinator
139
+ //= require slider
140
+ </plain>
141
+
142
+ Assets inside subdirectories can also be accessed.
143
+
144
+ <plain>
145
+ app/assets/javascripts/sub/something.js
146
+ </plain>
147
+
148
+ is referenced as:
149
+
150
+ <plain>
151
+ //= require sub/something
152
+ </plain>
153
+
154
+ You can view the search path by inspecting +Rails.application.config.assets.paths+ in the Rails console.
155
+
156
+ Additional (fully qualified) paths can be added to the pipeline in +config/application.rb+. For example:
157
+
158
+ <ruby>
159
+ config.assets.paths << Rails.root.join("app", "assets", "flash")
160
+ </ruby>
161
+
162
+ Paths are traversed in the order that they occur in the search path.
163
+
164
+ It is important to note that files you want to reference outside a manifest must be added to the precompile array or they will not be available in the production environment.
165
+
166
+ h5. Using index files
167
+
168
+ Sprockets uses files named +index+ (with the relevant extensions) for a special purpose.
169
+
170
+ For example, if you have a jQuery library with many modules, which is stored in +lib/assets/library_name+, the file +lib/assets/library_name/index.js+ serves as the manifest for all files in this library. This file could include a list of all the required files in order, or a simple <tt>require_tree</tt> directive.
171
+
172
+ The library as a whole can be accessed in the site's application manifest like so:
173
+
174
+ <plain>
175
+ //= require library_name
176
+ </plain>
177
+
178
+ This simplifies maintenance and keeps things clean by allowing related code to be grouped before inclusion elsewhere.
179
+
180
+ h4. Coding Links to Assets
181
+
182
+ Sprockets does not add any new methods to access your assets - you still use the familiar +javascript_include_tag+ and +stylesheet_link_tag+.
183
+
184
+ <erb>
185
+ <%= stylesheet_link_tag "application" %>
186
+ <%= javascript_include_tag "application" %>
187
+ </erb>
188
+
189
+ In regular views you can access images in the +assets/images+ directory like this:
190
+
191
+ <erb>
192
+ <%= image_tag "rails.png" %>
193
+ </erb>
194
+
195
+ Provided that the pipeline is enabled within your application (and not disabled in the current environment context), this file is served by Sprockets. If a file exists at +public/assets/rails.png+ it is served by the web server.
196
+
197
+ Alternatively, a request for a file with an MD5 hash such as +public/assets/rails-af27b6a414e6da00003503148be9b409.png+ is treated the same way. How these hashes are generated is covered in the "In Production":#in-production section later on in this guide.
198
+
199
+ Sprockets will also look through the paths specified in +config.assets.paths+ which includes the standard application paths and any path added by Rails engines.
200
+
201
+ Images can also be organized into subdirectories if required, and they can be accessed by specifying the directory's name in the tag:
202
+
203
+ <erb>
204
+ <%= image_tag "icons/rails.png" %>
205
+ </erb>
206
+
207
+ h5. CSS and ERB
208
+
209
+ The asset pipeline automatically evaluates ERB. This means that if you add an +erb+ extension to a CSS asset (for example, +application.css.erb+), then helpers like +asset_path+ are available in your CSS rules:
210
+
211
+ <plain>
212
+ .class { background-image: url(<%= asset_path 'image.png' %>) }
213
+ </plain>
214
+
215
+ This writes the path to the particular asset being referenced. In this example, it would make sense to have an image in one of the asset load paths, such as +app/assets/images/image.png+, which would be referenced here. If this image is already available in +public/assets+ as a fingerprinted file, then that path is referenced.
216
+
217
+ If you want to use a "data URI":http://en.wikipedia.org/wiki/Data_URI_scheme -- a method of embedding the image data directly into the CSS file -- you can use the +asset_data_uri+ helper.
218
+
219
+ <plain>
220
+ #logo { background: url(<%= asset_data_uri 'logo.png' %>) }
221
+ </plain>
222
+
223
+ This inserts a correctly-formatted data URI into the CSS source.
224
+
225
+ Note that the closing tag cannot be of the style +-%>+.
226
+
227
+ h5. CSS and Sass
228
+
229
+ When using the asset pipeline, paths to assets must be re-written and +sass-rails+ provides +-url+ and +-path+ helpers (hyphenated in Sass, underscored in Ruby) for the following asset classes: image, font, video, audio, JavaScript and stylesheet.
230
+
231
+ * +image-url("rails.png")+ becomes +url(/assets/rails.png)+
232
+ * +image-path("rails.png")+ becomes +"/assets/rails.png"+.
233
+
234
+ The more generic form can also be used but the asset path and class must both be specified:
235
+
236
+ * +asset-url("rails.png", image)+ becomes +url(/assets/rails.png)+
237
+ * +asset-path("rails.png", image)+ becomes +"/assets/rails.png"+
238
+
239
+ h5. JavaScript/CoffeeScript and ERB
240
+
241
+ If you add an +erb+ extension to a JavaScript asset, making it something such as +application.js.erb+, then you can use the +asset_path+ helper in your JavaScript code:
242
+
243
+ <erb>
244
+ $('#logo').attr({
245
+ src: "<%= asset_path('logo.png') %>"
246
+ });
247
+ </erb>
248
+
249
+ This writes the path to the particular asset being referenced.
250
+
251
+ Similarly, you can use the +asset_path+ helper in CoffeeScript files with +erb+ extension (e.g., +application.js.coffee.erb+):
252
+
253
+ <plain>
254
+ $('#logo').attr src: "<%= asset_path('logo.png') %>"
255
+ </plain>
256
+
257
+ h4. Manifest Files and Directives
258
+
259
+ Sprockets uses manifest files to determine which assets to include and serve. These manifest files contain _directives_ -- instructions that tell Sprockets which files to require in order to build a single CSS or JavaScript file. With these directives, Sprockets loads the files specified, processes them if necessary, concatenates them into one single file and then compresses them (if +Rails.application.config.assets.compress+ is true). By serving one file rather than many, the load time of pages can be greatly reduced because the browser makes fewer requests.
260
+
261
+ For example, a new Rails application includes a default +app/assets/javascripts/application.js+ file which contains the following lines:
262
+
263
+ <plain>
264
+ // ...
265
+ //= require jquery
266
+ //= require jquery_ujs
267
+ //= require_tree .
268
+ </plain>
269
+
270
+ In JavaScript files, the directives begin with +//=+. In this case, the file is using the +require+ and the +require_tree+ directives. The +require+ directive is used to tell Sprockets the files that you wish to require. Here, you are requiring the files +jquery.js+ and +jquery_ujs.js+ that are available somewhere in the search path for Sprockets. You need not supply the extensions explicitly. Sprockets assumes you are requiring a +.js+ file when done from within a +.js+ file.
271
+
272
+ NOTE. In Rails 3.1 the +jquery-rails+ gem provides the +jquery.js+ and +jquery_ujs.js+ files via the asset pipeline. You won't see them in the application tree.
273
+
274
+ The +require_tree+ directive tells Sprockets to recursively include _all_ JavaScript files in the specified directory into the output. These paths must be specified relative to the manifest file. You can also use the +require_directory+ directive which includes all JavaScript files only in the directory specified, without recursion.
275
+
276
+ Directives are processed top to bottom, but the order in which files are included by +require_tree+ is unspecified. You should not rely on any particular order among those. If you need to ensure some particular JavaScript ends up above some other in the concatenated file, require the prerequisite file first in the manifest. Note that the family of +require+ directives prevents files from being included twice in the output.
277
+
278
+ Rails also creates a default +app/assets/stylesheets/application.css+ file which contains these lines:
279
+
280
+ <plain>
281
+ /* ...
282
+ *= require_self
283
+ *= require_tree .
284
+ */
285
+ </plain>
286
+
287
+ The directives that work in the JavaScript files also work in stylesheets (though obviously including stylesheets rather than JavaScript files). The +require_tree+ directive in a CSS manifest works the same way as the JavaScript one, requiring all stylesheets from the current directory.
288
+
289
+ In this example +require_self+ is used. This puts the CSS contained within the file (if any) at the precise location of the +require_self+ call. If +require_self+ is called more than once, only the last call is respected.
290
+
291
+ NOTE. If you want to use multiple Sass files, you should generally use the "Sass +@import+ rule":http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#import instead of these Sprockets directives. Using Sprockets directives all Sass files exist within their own scope, making variables or mixins only available within the document they were defined in.
292
+
293
+ You can have as many manifest files as you need. For example the +admin.css+ and +admin.js+ manifest could contain the JS and CSS files that are used for the admin section of an application.
294
+
295
+ The same remarks about ordering made above apply. In particular, you can specify individual files and they are compiled in the order specified. For example, you might concatenate three CSS files together this way:
296
+
297
+ <plain>
298
+ /* ...
299
+ *= require reset
300
+ *= require layout
301
+ *= require chrome
302
+ */
303
+ </plain>
304
+
305
+
306
+ h4. Preprocessing
307
+
308
+ The file extensions used on an asset determine what preprocessing is applied. When a controller or a scaffold is generated with the default Rails gemset, a CoffeeScript file and a SCSS file are generated in place of a regular JavaScript and CSS file. The example used before was a controller called "projects", which generated an +app/assets/javascripts/projects.js.coffee+ and an +app/assets/stylesheets/projects.css.scss+ file.
309
+
310
+ When these files are requested, they are processed by the processors provided by the +coffee-script+ and +sass+ gems and then sent back to the browser as JavaScript and CSS respectively.
311
+
312
+ Additional layers of preprocessing can be requested by adding other extensions, where each extension is processed in a right-to-left manner. These should be used in the order the processing should be applied. For example, a stylesheet called +app/assets/stylesheets/projects.css.scss.erb+ is first processed as ERB, then SCSS, and finally served as CSS. The same applies to a JavaScript file -- +app/assets/javascripts/projects.js.coffee.erb+ is processed as ERB, then CoffeeScript, and served as JavaScript.
313
+
314
+ Keep in mind that the order of these preprocessors is important. For example, if you called your JavaScript file +app/assets/javascripts/projects.js.erb.coffee+ then it would be processed with the CoffeeScript interpreter first, which wouldn't understand ERB and therefore you would run into problems.
315
+
316
+ h3. In Development
317
+
318
+ In development mode, assets are served as separate files in the order they are specified in the manifest file.
319
+
320
+ This manifest +app/assets/javascripts/application.js+:
321
+
322
+ <plain>
323
+ //= require core
324
+ //= require projects
325
+ //= require tickets
326
+ </plain>
327
+
328
+ would generate this HTML:
329
+
330
+ <html>
331
+ <script src="/assets/core.js?body=1" type="text/javascript"></script>
332
+ <script src="/assets/projects.js?body=1" type="text/javascript"></script>
333
+ <script src="/assets/tickets.js?body=1" type="text/javascript"></script>
334
+ </html>
335
+
336
+ The +body+ param is required by Sprockets.
337
+
338
+ h4. Turning Debugging off
339
+
340
+ You can turn off debug mode by updating +config/environments/development.rb+ to include:
341
+
342
+ <ruby>
343
+ config.assets.debug = false
344
+ </ruby>
345
+
346
+ When debug mode is off, Sprockets concatenates and runs the necessary preprocessors on all files. With debug mode turned off the manifest above would generate instead:
347
+
348
+ <html>
349
+ <script src="/assets/application.js" type="text/javascript"></script>
350
+ </html>
351
+
352
+ Assets are compiled and cached on the first request after the server is started. Sprockets sets a +must-revalidate+ Cache-Control HTTP header to reduce request overhead on subsequent requests -- on these the browser gets a 304 (Not Modified) response.
353
+
354
+ If any of the files in the manifest have changed between requests, the server responds with a new compiled file.
355
+
356
+ Debug mode can also be enabled in the Rails helper methods:
357
+
358
+ <erb>
359
+ <%= stylesheet_link_tag "application", :debug => true %>
360
+ <%= javascript_include_tag "application", :debug => true %>
361
+ </erb>
362
+
363
+ The +:debug+ option is redundant if debug mode is on.
364
+
365
+ You could potentially also enable compression in development mode as a sanity check, and disable it on-demand as required for debugging.
366
+
367
+ h3. In Production
368
+
369
+ In the production environment Rails uses the fingerprinting scheme outlined above. By default Rails assumes that assets have been precompiled and will be served as static assets by your web server.
370
+
371
+ During the precompilation phase an MD5 is generated from the contents of the compiled files, and inserted into the filenames as they are written to disc. These fingerprinted names are used by the Rails helpers in place of the manifest name.
372
+
373
+ For example this:
374
+
375
+ <erb>
376
+ <%= javascript_include_tag "application" %>
377
+ <%= stylesheet_link_tag "application" %>
378
+ </erb>
379
+
380
+ generates something like this:
381
+
382
+ <html>
383
+ <script src="/assets/application-908e25f4bf641868d8683022a5b62f54.js" type="text/javascript"></script>
384
+ <link href="/assets/application-4dd5b109ee3439da54f5bdfd78a80473.css" media="screen" rel="stylesheet" type="text/css" />
385
+ </html>
386
+
387
+ The fingerprinting behavior is controlled by the setting of +config.assets.digest+ setting in Rails (which defaults to +true+ for production and +false+ for everything else).
388
+
389
+ NOTE: Under normal circumstances the default option should not be changed. If there are no digests in the filenames, and far-future headers are set, remote clients will never know to refetch the files when their content changes.
390
+
391
+ h4. Precompiling Assets
392
+
393
+ Rails comes bundled with a rake task to compile the asset manifests and other files in the pipeline to the disk.
394
+
395
+ Compiled assets are written to the location specified in +config.assets.prefix+. By default, this is the +public/assets+ directory.
396
+
397
+ You can call this task on the server during deployment to create compiled versions of your assets directly on the server. If you do not have write access to your production file system, you can call this task locally and then deploy the compiled assets.
398
+
399
+ The rake task is:
400
+
401
+ <plain>
402
+ bundle exec rake assets:precompile
403
+ </plain>
404
+
405
+ For faster asset precompiles, you can partially load your application by setting
406
+ +config.assets.initialize_on_precompile+ to false in +config/application.rb+, though in that case templates
407
+ cannot see application objects or methods. *Heroku requires this to be false.*
408
+
409
+ WARNING: If you set +config.assets.initialize_on_precompile+ to false, be sure to
410
+ test +rake assets:precompile+ locally before deploying. It may expose bugs where
411
+ your assets reference application objects or methods, since those are still
412
+ in scope in development mode regardless of the value of this flag.
413
+
414
+ Capistrano (v2.8.0 and above) includes a recipe to handle this in deployment. Add the following line to +Capfile+:
415
+
416
+ <erb>
417
+ load 'deploy/assets'
418
+ </erb>
419
+
420
+ This links the folder specified in +config.assets.prefix+ to +shared/assets+. If you already use this shared folder you'll need to write your own deployment task.
421
+
422
+ It is important that this folder is shared between deployments so that remotely cached pages that reference the old compiled assets still work for the life of the cached page.
423
+
424
+ NOTE. If you are precompiling your assets locally, you can use +bundle install --without assets+ on the server to avoid installing the assets gems (the gems in the assets group in the Gemfile).
425
+
426
+ The default matcher for compiling files includes +application.js+, +application.css+ and all non-JS/CSS files (i.e., +.coffee+ and +.scss+ files are *not* automatically included as they compile to JS/CSS):
427
+
428
+ <ruby>
429
+ [ Proc.new{ |path| !File.extname(path).in?(['.js', '.css']) }, /application.(css|js)$/ ]
430
+ </ruby>
431
+
432
+ If you have other manifests or individual stylesheets and JavaScript files to include, you can add them to the +precompile+ array:
433
+
434
+ <erb>
435
+ config.assets.precompile += ['admin.js', 'admin.css', 'swfObject.js']
436
+ </erb>
437
+
438
+ The rake task also generates a +manifest.yml+ that contains a list with all your assets and their respective fingerprints. This is used by the Rails helper methods to avoid handing the mapping requests back to Sprockets. A typical manifest file looks like:
439
+
440
+ <plain>
441
+ ---
442
+ rails.png: rails-bd9ad5a560b5a3a7be0808c5cd76a798.png
443
+ jquery-ui.min.js: jquery-ui-7e33882a28fc84ad0e0e47e46cbf901c.min.js
444
+ jquery.min.js: jquery-8a50feed8d29566738ad005e19fe1c2d.min.js
445
+ application.js: application-3fdab497b8fb70d20cfc5495239dfc29.js
446
+ application.css: application-8af74128f904600e41a6e39241464e03.css
447
+ </plain>
448
+
449
+ The default location for the manifest is the root of the location specified in +config.assets.prefix+ ('/assets' by default).
450
+
451
+ This can be changed with the +config.assets.manifest+ option. A fully specified path is required:
452
+
453
+ <erb>
454
+ config.assets.manifest = '/path/to/some/other/location'
455
+ </erb>
456
+
457
+ NOTE: If there are missing precompiled files in production you will get an <tt>Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError</tt> exception indicating the name of the missing file(s).
458
+
459
+ h5. Server Configuration
460
+
461
+ Precompiled assets exist on the filesystem and are served directly by your web server. They do not have far-future headers by default, so to get the benefit of fingerprinting you'll have to update your server configuration to add them.
462
+
463
+ For Apache:
464
+
465
+ <plain>
466
+ <LocationMatch "^/assets/.*$">
467
+ Header unset ETag
468
+ FileETag None
469
+ # RFC says only cache for 1 year
470
+ ExpiresActive On
471
+ ExpiresDefault "access plus 1 year"
472
+ </LocationMatch>
473
+ </plain>
474
+
475
+ For nginx:
476
+
477
+ <plain>
478
+ location ~ ^/assets/ {
479
+ expires 1y;
480
+ add_header Cache-Control public;
481
+
482
+ add_header ETag "";
483
+ break;
484
+ }
485
+ </plain>
486
+
487
+ When files are precompiled, Sprockets also creates a "gzipped":http://en.wikipedia.org/wiki/Gzip (.gz) version of your assets. Web servers are typically configured to use a moderate compression ratio as a compromise, but since precompilation happens once, Sprockets uses the maximum compression ratio, thus reducing the size of the data transfer to the minimum. On the other hand, web servers can be configured to serve compressed content directly from disk, rather than deflating non-compressed files themselves.
488
+
489
+ Nginx is able to do this automatically enabling +gzip_static+:
490
+
491
+ <plain>
492
+ location ~ ^/(assets)/ {
493
+ root /path/to/public;
494
+ gzip_static on; # to serve pre-gzipped version
495
+ expires max;
496
+ add_header Cache-Control public;
497
+ }
498
+ </plain>
499
+
500
+ This directive is available if the core module that provides this feature was compiled with the web server. Ubuntu packages, even +nginx-light+ have the module compiled. Otherwise, you may need to perform a manual compilation:
501
+
502
+ <plain>
503
+ ./configure --with-http_gzip_static_module
504
+ </plain>
505
+
506
+ If you're compiling nginx with Phusion Passenger you'll need to pass that option when prompted.
507
+
508
+ A robust configuration for Apache is possible but tricky; please Google around. (Or help update this Guide if you have a good example configuration for Apache.)
509
+
510
+ h4. Live Compilation
511
+
512
+ In some circumstances you may wish to use live compilation. In this mode all requests for assets in the pipeline are handled by Sprockets directly.
513
+
514
+ To enable this option set:
515
+
516
+ <erb>
517
+ config.assets.compile = true
518
+ </erb>
519
+
520
+ On the first request the assets are compiled and cached as outlined in development above, and the manifest names used in the helpers are altered to include the MD5 hash.
521
+
522
+ Sprockets also sets the +Cache-Control+ HTTP header to +max-age=31536000+. This signals all caches between your server and the client browser that this content (the file served) can be cached for 1 year. The effect of this is to reduce the number of requests for this asset from your server; the asset has a good chance of being in the local browser cache or some intermediate cache.
523
+
524
+ This mode uses more memory, performs more poorly than the default and is not recommended.
525
+
526
+ If you are deploying a production application to a system without any pre-existing JavaScript runtimes, you may want to add one to your Gemfile:
527
+
528
+ <plain>
529
+ group :production do
530
+ gem 'therubyracer'
531
+ end
532
+ </plain>
533
+
534
+ h3. Customizing the Pipeline
535
+
536
+ h4. CSS Compression
537
+
538
+ There is currently one option for compressing CSS, YUI. The "YUI CSS compressor":http://developer.yahoo.com/yui/compressor/css.html provides minification.
539
+
540
+ The following line enables YUI compression, and requires the +yui-compressor+ gem.
541
+
542
+ <erb>
543
+ config.assets.css_compressor = :yui
544
+ </erb>
545
+
546
+ The +config.assets.compress+ must be set to +true+ to enable CSS compression.
547
+
548
+ h4. JavaScript Compression
549
+
550
+ Possible options for JavaScript compression are +:closure+, +:uglifier+ and +:yui+. These require the use of the +closure-compiler+, +uglifier+ or +yui-compressor+ gems, respectively.
551
+
552
+ The default Gemfile includes "uglifier":https://github.com/lautis/uglifier. This gem wraps "UglifierJS":https://github.com/mishoo/UglifyJS (written for NodeJS) in Ruby. It compresses your code by removing white space. It also includes other optimizations such as changing your +if+ and +else+ statements to ternary operators where possible.
553
+
554
+ The following line invokes +uglifier+ for JavaScript compression.
555
+
556
+ <erb>
557
+ config.assets.js_compressor = :uglifier
558
+ </erb>
559
+
560
+ Note that +config.assets.compress+ must be set to +true+ to enable JavaScript compression
561
+
562
+ NOTE: You will need an "ExecJS":https://github.com/sstephenson/execjs#readme supported runtime in order to use +uglifier+. If you are using Mac OS X or Windows you have a JavaScript runtime installed in your operating system. Check the "ExecJS":https://github.com/sstephenson/execjs#readme documentation for information on all of the supported JavaScript runtimes.
563
+
564
+ h4. Using Your Own Compressor
565
+
566
+ The compressor config settings for CSS and JavaScript also take any object. This object must have a +compress+ method that takes a string as the sole argument and it must return a string.
567
+
568
+ <erb>
569
+ class Transformer
570
+ def compress(string)
571
+ do_something_returning_a_string(string)
572
+ end
573
+ end
574
+ </erb>
575
+
576
+ To enable this, pass a +new+ object to the config option in +application.rb+:
577
+
578
+ <erb>
579
+ config.assets.css_compressor = Transformer.new
580
+ </erb>
581
+
582
+
583
+ h4. Changing the _assets_ Path
584
+
585
+ The public path that Sprockets uses by default is +/assets+.
586
+
587
+ This can be changed to something else:
588
+
589
+ <erb>
590
+ config.assets.prefix = "/some_other_path"
591
+ </erb>
592
+
593
+ This is a handy option if you are updating an existing project (pre Rails 3.1) that already uses this path or you wish to use this path for a new resource.
594
+
595
+ h4. X-Sendfile Headers
596
+
597
+ The X-Sendfile header is a directive to the web server to ignore the response from the application, and instead serve a specified file from disk. This option is off by default, but can be enabled if your server supports it. When enabled, this passes responsibility for serving the file to the web server, which is faster.
598
+
599
+ Apache and nginx support this option, which can be enabled in <tt>config/environments/production.rb</tt>.
600
+
601
+ <erb>
602
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
603
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
604
+ </erb>
605
+
606
+ WARNING: If you are upgrading an existing application and intend to use this option, take care to paste this configuration option only into +production.rb+ and any other environments you define with production behavior (not +application.rb+).
607
+
608
+ h3. How Caching Works
609
+
610
+ Sprockets uses the default Rails cache store to cache assets in development and production.
611
+
612
+ TODO: Add more about changing the default store.
613
+
614
+ h3. Adding Assets to Your Gems
615
+
616
+ Assets can also come from external sources in the form of gems.
617
+
618
+ A good example of this is the +jquery-rails+ gem which comes with Rails as the standard JavaScript library gem. This gem contains an engine class which inherits from +Rails::Engine+. By doing this, Rails is informed that the directory for this gem may contain assets and the +app/assets+, +lib/assets+ and +vendor/assets+ directories of this engine are added to the search path of Sprockets.
619
+
620
+ h3. Making Your Library or Gem a Pre-Processor
621
+
622
+ TODO: Registering gems on "Tilt":https://github.com/rtomayko/tilt enabling Sprockets to find them.
623
+
624
+ h3. Upgrading from Old Versions of Rails
625
+
626
+ There are two issues when upgrading. The first is moving the files from +public/+ to the new locations. See "Asset Organization":#asset-organization above for guidance on the correct locations for different file types.
627
+
628
+ The second is updating the various environment files with the correct default options. The following changes reflect the defaults in version 3.1.0.
629
+
630
+ In +application.rb+:
631
+
632
+ <erb>
633
+ # Enable the asset pipeline
634
+ config.assets.enabled = true
635
+
636
+ # Version of your assets, change this if you want to expire all your assets
637
+ config.assets.version = '1.0'
638
+
639
+ # Change the path that assets are served from
640
+ # config.assets.prefix = "/assets"
641
+ </erb>
642
+
643
+ In +development.rb+:
644
+
645
+ <erb>
646
+ # Do not compress assets
647
+ config.assets.compress = false
648
+
649
+ # Expands the lines which load the assets
650
+ config.assets.debug = true
651
+ </erb>
652
+
653
+ And in +production.rb+:
654
+
655
+ <erb>
656
+ # Compress JavaScripts and CSS
657
+ config.assets.compress = true
658
+
659
+ # Choose the compressors to use
660
+ # config.assets.js_compressor = :uglifier
661
+ # config.assets.css_compressor = :yui
662
+
663
+ # Don't fallback to assets pipeline if a precompiled asset is missed
664
+ config.assets.compile = false
665
+
666
+ # Generate digests for assets URLs.
667
+ config.assets.digest = true
668
+
669
+ # Defaults to Rails.root.join("public/assets")
670
+ # config.assets.manifest = YOUR_PATH
671
+
672
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
673
+ # config.assets.precompile += %w( search.js )
674
+ </erb>
675
+
676
+ You should not need to change +test.rb+. The defaults in the test environment are: +config.assets.compile+ is true and +config.assets.compress+, +config.assets.debug+ and +config.assets.digest+ are false.
677
+
678
+ The following should also be added to +Gemfile+:
679
+
680
+ <plain>
681
+ # Gems used only for assets and not required
682
+ # in production environments by default.
683
+ group :assets do
684
+ gem 'sass-rails', "~> 3.1.0"
685
+ gem 'coffee-rails', "~> 3.1.0"
686
+ gem 'uglifier'
687
+ end
688
+ </plain>
689
+
690
+ If you use the +assets+ group with Bundler, please make sure that your +config/application.rb+ has the following Bundler require statement:
691
+
692
+ <ruby>
693
+ if defined?(Bundler)
694
+ # If you precompile assets before deploying to production, use this line
695
+ Bundler.require *Rails.groups(:assets => %w(development test))
696
+ # If you want your assets lazily compiled in production, use this line
697
+ # Bundler.require(:default, :assets, Rails.env)
698
+ end
699
+ </ruby>
700
+
701
+ Instead of the old Rails 3.0 version:
702
+
703
+ <ruby>
704
+ # If you have a Gemfile, require the gems listed there, including any gems
705
+ # you've limited to :test, :development, or :production.
706
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
707
+ </ruby>