railties 3.0.11 → 3.0.12.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rails/version.rb +2 -2
- metadata +305 -461
- data/guides/output/2_2_release_notes.html +0 -565
- data/guides/output/2_3_release_notes.html +0 -713
- data/guides/output/3_0_release_notes.html +0 -652
- data/guides/output/3_1_release_notes.html +0 -670
- data/guides/output/action_controller_overview.html +0 -925
- data/guides/output/action_mailer_basics.html +0 -658
- data/guides/output/action_view_overview.html +0 -1471
- data/guides/output/active_model_basics.html +0 -349
- data/guides/output/active_record_basics.html +0 -364
- data/guides/output/active_record_querying.html +0 -1272
- data/guides/output/active_record_validations_callbacks.html +0 -1292
- data/guides/output/active_resource_basics.html +0 -252
- data/guides/output/active_support_core_extensions.html +0 -3374
- data/guides/output/ajax_on_rails.html +0 -412
- data/guides/output/api_documentation_guidelines.html +0 -317
- data/guides/output/asset_pipeline.html +0 -691
- data/guides/output/association_basics.html +0 -1742
- data/guides/output/caching_with_rails.html +0 -533
- data/guides/output/command_line.html +0 -662
- data/guides/output/configuring.html +0 -811
- data/guides/output/contribute.html +0 -216
- data/guides/output/contributing_to_ruby_on_rails.html +0 -465
- data/guides/output/credits.html +0 -210
- data/guides/output/debugging_rails_applications.html +0 -791
- data/guides/output/engines.html +0 -673
- data/guides/output/form_helpers.html +0 -850
- data/guides/output/generators.html +0 -725
- data/guides/output/getting_started.html +0 -1980
- data/guides/output/i18n.html +0 -1054
- data/guides/output/images/belongs_to.png +0 -0
- data/guides/output/images/book_icon.gif +0 -0
- data/guides/output/images/bullet.gif +0 -0
- data/guides/output/images/challenge.png +0 -0
- data/guides/output/images/chapters_icon.gif +0 -0
- data/guides/output/images/check_bullet.gif +0 -0
- data/guides/output/images/credits_pic_blank.gif +0 -0
- data/guides/output/images/csrf.png +0 -0
- data/guides/output/images/customized_error_messages.png +0 -0
- data/guides/output/images/edge_badge.png +0 -0
- data/guides/output/images/error_messages.png +0 -0
- data/guides/output/images/feature_tile.gif +0 -0
- data/guides/output/images/footer_tile.gif +0 -0
- data/guides/output/images/fxn.png +0 -0
- data/guides/output/images/grey_bullet.gif +0 -0
- data/guides/output/images/habtm.png +0 -0
- data/guides/output/images/has_many.png +0 -0
- data/guides/output/images/has_many_through.png +0 -0
- data/guides/output/images/has_one.png +0 -0
- data/guides/output/images/has_one_through.png +0 -0
- data/guides/output/images/header_backdrop.png +0 -0
- data/guides/output/images/header_tile.gif +0 -0
- data/guides/output/images/i18n/demo_html_safe.png +0 -0
- data/guides/output/images/i18n/demo_localized_pirate.png +0 -0
- data/guides/output/images/i18n/demo_translated_en.png +0 -0
- data/guides/output/images/i18n/demo_translated_pirate.png +0 -0
- data/guides/output/images/i18n/demo_translation_missing.png +0 -0
- data/guides/output/images/i18n/demo_untranslated.png +0 -0
- data/guides/output/images/icons/README +0 -5
- data/guides/output/images/icons/callouts/1.png +0 -0
- data/guides/output/images/icons/callouts/10.png +0 -0
- data/guides/output/images/icons/callouts/11.png +0 -0
- data/guides/output/images/icons/callouts/12.png +0 -0
- data/guides/output/images/icons/callouts/13.png +0 -0
- data/guides/output/images/icons/callouts/14.png +0 -0
- data/guides/output/images/icons/callouts/15.png +0 -0
- data/guides/output/images/icons/callouts/2.png +0 -0
- data/guides/output/images/icons/callouts/3.png +0 -0
- data/guides/output/images/icons/callouts/4.png +0 -0
- data/guides/output/images/icons/callouts/5.png +0 -0
- data/guides/output/images/icons/callouts/6.png +0 -0
- data/guides/output/images/icons/callouts/7.png +0 -0
- data/guides/output/images/icons/callouts/8.png +0 -0
- data/guides/output/images/icons/callouts/9.png +0 -0
- data/guides/output/images/icons/caution.png +0 -0
- data/guides/output/images/icons/example.png +0 -0
- data/guides/output/images/icons/home.png +0 -0
- data/guides/output/images/icons/important.png +0 -0
- data/guides/output/images/icons/next.png +0 -0
- data/guides/output/images/icons/note.png +0 -0
- data/guides/output/images/icons/prev.png +0 -0
- data/guides/output/images/icons/tip.png +0 -0
- data/guides/output/images/icons/up.png +0 -0
- data/guides/output/images/icons/warning.png +0 -0
- data/guides/output/images/jaimeiniesta.jpg +0 -0
- data/guides/output/images/nav_arrow.gif +0 -0
- data/guides/output/images/polymorphic.png +0 -0
- data/guides/output/images/posts_index.png +0 -0
- data/guides/output/images/radar.png +0 -0
- data/guides/output/images/rails_guides_logo.gif +0 -0
- data/guides/output/images/rails_logo_remix.gif +0 -0
- data/guides/output/images/rails_welcome.png +0 -0
- data/guides/output/images/session_fixation.png +0 -0
- data/guides/output/images/tab_grey.gif +0 -0
- data/guides/output/images/tab_info.gif +0 -0
- data/guides/output/images/tab_note.gif +0 -0
- data/guides/output/images/tab_red.gif +0 -0
- data/guides/output/images/tab_yellow.gif +0 -0
- data/guides/output/images/tab_yellow.png +0 -0
- data/guides/output/images/validation_error_messages.png +0 -0
- data/guides/output/images/vijaydev.jpg +0 -0
- data/guides/output/index.html +0 -300
- data/guides/output/initialization.html +0 -1087
- data/guides/output/javascripts/guides.js +0 -7
- data/guides/output/javascripts/syntaxhighlighter/shBrushAS3.js +0 -59
- data/guides/output/javascripts/syntaxhighlighter/shBrushAppleScript.js +0 -75
- data/guides/output/javascripts/syntaxhighlighter/shBrushBash.js +0 -59
- data/guides/output/javascripts/syntaxhighlighter/shBrushCSharp.js +0 -65
- data/guides/output/javascripts/syntaxhighlighter/shBrushColdFusion.js +0 -100
- data/guides/output/javascripts/syntaxhighlighter/shBrushCpp.js +0 -97
- data/guides/output/javascripts/syntaxhighlighter/shBrushCss.js +0 -91
- data/guides/output/javascripts/syntaxhighlighter/shBrushDelphi.js +0 -55
- data/guides/output/javascripts/syntaxhighlighter/shBrushDiff.js +0 -41
- data/guides/output/javascripts/syntaxhighlighter/shBrushErlang.js +0 -52
- data/guides/output/javascripts/syntaxhighlighter/shBrushGroovy.js +0 -67
- data/guides/output/javascripts/syntaxhighlighter/shBrushJScript.js +0 -52
- data/guides/output/javascripts/syntaxhighlighter/shBrushJava.js +0 -57
- data/guides/output/javascripts/syntaxhighlighter/shBrushJavaFX.js +0 -58
- data/guides/output/javascripts/syntaxhighlighter/shBrushPerl.js +0 -72
- data/guides/output/javascripts/syntaxhighlighter/shBrushPhp.js +0 -88
- data/guides/output/javascripts/syntaxhighlighter/shBrushPlain.js +0 -33
- data/guides/output/javascripts/syntaxhighlighter/shBrushPowerShell.js +0 -74
- data/guides/output/javascripts/syntaxhighlighter/shBrushPython.js +0 -64
- data/guides/output/javascripts/syntaxhighlighter/shBrushRuby.js +0 -55
- data/guides/output/javascripts/syntaxhighlighter/shBrushSass.js +0 -94
- data/guides/output/javascripts/syntaxhighlighter/shBrushScala.js +0 -51
- data/guides/output/javascripts/syntaxhighlighter/shBrushSql.js +0 -66
- data/guides/output/javascripts/syntaxhighlighter/shBrushVb.js +0 -56
- data/guides/output/javascripts/syntaxhighlighter/shBrushXml.js +0 -69
- data/guides/output/javascripts/syntaxhighlighter/shCore.js +0 -17
- data/guides/output/layout.html +0 -312
- data/guides/output/layouts_and_rendering.html +0 -1257
- data/guides/output/migrations.html +0 -751
- data/guides/output/nested_model_forms.html +0 -350
- data/guides/output/performance_testing.html +0 -858
- data/guides/output/plugins.html +0 -590
- data/guides/output/rails_application_templates.html +0 -368
- data/guides/output/rails_on_rack.html +0 -408
- data/guides/output/routing.html +0 -1246
- data/guides/output/ruby_on_rails_guides_guidelines.html +0 -218
- data/guides/output/security.html +0 -968
- data/guides/output/stylesheets/fixes.css +0 -16
- data/guides/output/stylesheets/main.css +0 -445
- data/guides/output/stylesheets/print.css +0 -52
- data/guides/output/stylesheets/reset.css +0 -43
- data/guides/output/stylesheets/style.css +0 -13
- data/guides/output/stylesheets/syntaxhighlighter/shCore.css +0 -226
- data/guides/output/stylesheets/syntaxhighlighter/shCoreDefault.css +0 -328
- data/guides/output/stylesheets/syntaxhighlighter/shCoreDjango.css +0 -331
- data/guides/output/stylesheets/syntaxhighlighter/shCoreEclipse.css +0 -339
- data/guides/output/stylesheets/syntaxhighlighter/shCoreEmacs.css +0 -324
- data/guides/output/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
- data/guides/output/stylesheets/syntaxhighlighter/shCoreMDUltra.css +0 -324
- data/guides/output/stylesheets/syntaxhighlighter/shCoreMidnight.css +0 -324
- data/guides/output/stylesheets/syntaxhighlighter/shCoreRDark.css +0 -324
- data/guides/output/stylesheets/syntaxhighlighter/shThemeDefault.css +0 -117
- data/guides/output/stylesheets/syntaxhighlighter/shThemeDjango.css +0 -120
- data/guides/output/stylesheets/syntaxhighlighter/shThemeEclipse.css +0 -128
- data/guides/output/stylesheets/syntaxhighlighter/shThemeEmacs.css +0 -113
- data/guides/output/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
- data/guides/output/stylesheets/syntaxhighlighter/shThemeMDUltra.css +0 -113
- data/guides/output/stylesheets/syntaxhighlighter/shThemeMidnight.css +0 -113
- data/guides/output/stylesheets/syntaxhighlighter/shThemeRDark.css +0 -113
- data/guides/output/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +0 -116
- data/guides/output/testing.html +0 -1182
@@ -1,565 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
-
|
8
|
-
<title>Ruby on Rails Guides: Ruby on Rails 2.2 Release Notes</title>
|
9
|
-
|
10
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
|
11
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
|
12
|
-
|
13
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shCore.css" />
|
14
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shThemeRailsGuides.css" />
|
15
|
-
|
16
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/fixes.css" />
|
17
|
-
</head>
|
18
|
-
<body class="guide">
|
19
|
-
<div id="topNav">
|
20
|
-
<div class="wrapper">
|
21
|
-
<strong>More at <a href="http://rubyonrails.org/">rubyonrails.org:</a> </strong>
|
22
|
-
<a href="http://rubyonrails.org/">Overview</a> |
|
23
|
-
<a href="http://rubyonrails.org/download">Download</a> |
|
24
|
-
<a href="http://rubyonrails.org/deploy">Deploy</a> |
|
25
|
-
<a href="https://github.com/rails/rails">Code</a> |
|
26
|
-
<a href="http://rubyonrails.org/screencasts">Screencasts</a> |
|
27
|
-
<a href="http://rubyonrails.org/documentation">Documentation</a> |
|
28
|
-
<a href="http://rubyonrails.org/ecosystem">Ecosystem</a> |
|
29
|
-
<a href="http://rubyonrails.org/community">Community</a> |
|
30
|
-
<a href="http://weblog.rubyonrails.org/">Blog</a>
|
31
|
-
</div>
|
32
|
-
</div>
|
33
|
-
<div id="header">
|
34
|
-
<div class="wrapper clearfix">
|
35
|
-
<h1><a href="index.html" title="Return to home page">Guides.rubyonrails.org</a></h1>
|
36
|
-
<p class="hide"><a href="#mainCol">Skip navigation</a>.</p>
|
37
|
-
<ul class="nav">
|
38
|
-
<li><a href="index.html">Home</a></li>
|
39
|
-
<li class="index"><a href="index.html" onclick="guideMenu(); return false;" id="guidesMenu">Guides Index</a>
|
40
|
-
<div id="guides" class="clearfix" style="display: none;">
|
41
|
-
<hr />
|
42
|
-
<dl class="L">
|
43
|
-
<dt>Start Here</dt>
|
44
|
-
<dd><a href="getting_started.html">Getting Started with Rails</a></dd>
|
45
|
-
<dt>Models</dt>
|
46
|
-
<dd><a href="migrations.html">Rails Database Migrations</a></dd>
|
47
|
-
<dd><a href="active_record_validations_callbacks.html">Active Record Validations and Callbacks</a></dd>
|
48
|
-
<dd><a href="association_basics.html">Active Record Associations</a></dd>
|
49
|
-
<dd><a href="active_record_querying.html">Active Record Query Interface</a></dd>
|
50
|
-
<dt>Views</dt>
|
51
|
-
<dd><a href="layouts_and_rendering.html">Layouts and Rendering in Rails</a></dd>
|
52
|
-
<dd><a href="form_helpers.html">Action View Form Helpers</a></dd>
|
53
|
-
<dt>Controllers</dt>
|
54
|
-
<dd><a href="action_controller_overview.html">Action Controller Overview</a></dd>
|
55
|
-
<dd><a href="routing.html">Rails Routing from the Outside In</a></dd>
|
56
|
-
</dl>
|
57
|
-
<dl class="R">
|
58
|
-
<dt>Digging Deeper</dt>
|
59
|
-
<dd><a href="active_support_core_extensions.html">Active Support Core Extensions</a></dd>
|
60
|
-
<dd><a href="i18n.html">Rails Internationalization API</a></dd>
|
61
|
-
<dd><a href="action_mailer_basics.html">Action Mailer Basics</a></dd>
|
62
|
-
<dd><a href="testing.html">Testing Rails Applications</a></dd>
|
63
|
-
<dd><a href="security.html">Securing Rails Applications</a></dd>
|
64
|
-
<dd><a href="debugging_rails_applications.html">Debugging Rails Applications</a></dd>
|
65
|
-
<dd><a href="performance_testing.html">Performance Testing Rails Applications</a></dd>
|
66
|
-
<dd><a href="configuring.html">Configuring Rails Applications</a></dd>
|
67
|
-
<dd><a href="command_line.html">Rails Command Line Tools and Rake Tasks</a></dd>
|
68
|
-
<dd><a href="caching_with_rails.html">Caching with Rails</a></dd>
|
69
|
-
<dd><a href="asset_pipeline.html">Asset Pipeline</a></dd>
|
70
|
-
|
71
|
-
<dt>Extending Rails</dt>
|
72
|
-
<dd><a href="plugins.html">The Basics of Creating Rails Plugins</a></dd>
|
73
|
-
<dd><a href="rails_on_rack.html">Rails on Rack</a></dd>
|
74
|
-
<dd><a href="generators.html">Creating and Customizing Rails Generators</a></dd>
|
75
|
-
|
76
|
-
<dt>Contributing to Ruby on Rails</dt>
|
77
|
-
<dd><a href="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</a></dd>
|
78
|
-
<dd><a href="api_documentation_guidelines.html">API Documentation Guidelines</a></dd>
|
79
|
-
<dd><a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a></dd>
|
80
|
-
|
81
|
-
<dt>Release Notes</dt>
|
82
|
-
<dd><a href="3_1_release_notes.html">Ruby on Rails 3.1 Release Notes</a></dd>
|
83
|
-
<dd><a href="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</a></dd>
|
84
|
-
<dd><a href="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</a></dd>
|
85
|
-
<dd><a href="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</a></dd>
|
86
|
-
</dl>
|
87
|
-
</div>
|
88
|
-
</li>
|
89
|
-
<li><a href="contributing_to_ruby_on_rails.html">Contribute</a></li>
|
90
|
-
<li><a href="credits.html">Credits</a></li>
|
91
|
-
</ul>
|
92
|
-
</div>
|
93
|
-
</div>
|
94
|
-
<hr class="hide" />
|
95
|
-
|
96
|
-
<div id="feature">
|
97
|
-
<div class="wrapper">
|
98
|
-
<h2>Ruby on Rails 2.2 Release Notes</h2>
|
99
|
-
<p>Rails 2.2 delivers a number of new and improved features. This list covers the major upgrades, but doesn’t include every little bug fix and change. If you want to see everything, check out the <a href="http://github.com/rails/rails/commits/master">list of commits</a> in the main Rails repository on GitHub.</p>
|
100
|
-
<p>Along with Rails, 2.2 marks the launch of the <a href="http://guides.rubyonrails.org/">Ruby on Rails Guides</a>, the first results of the ongoing <a href="http://hackfest.rubyonrails.org/guide">Rails Guides hackfest</a>. This site will deliver high-quality documentation of the major features of Rails.</p>
|
101
|
-
|
102
|
-
<div id="subCol">
|
103
|
-
<h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
|
104
|
-
<ol class="chapters">
|
105
|
-
<li><a href="#infrastructure">Infrastructure</a><ul><li><a href="#internationalization">Internationalization</a></li> <li><a href="#compatibility-with-ruby-1-9-and-jruby">Compatibility with Ruby 1.9 and JRuby</a></li></ul></li><li><a href="#documentation">Documentation</a></li><li><a href="#better-integration-with-http-out-of-the-box-etag-support">Better integration with <span class="caps">HTTP</span> : Out of the box ETag support</a></li><li><a href="#thread-safety">Thread Safety</a></li><li><a href="#active-record">Active Record</a><ul><li><a href="#transactional-migrations">Transactional Migrations</a></li> <li><a href="#connection-pooling">Connection Pooling</a></li> <li><a href="#hashes-for-join-table-conditions">Hashes for Join Table Conditions</a></li> <li><a href="#new-dynamic-finders">New Dynamic Finders</a></li> <li><a href="#associations-respect-private-protected-scope">Associations Respect Private/Protected Scope</a></li> <li><a href="#other-activerecord-changes">Other ActiveRecord Changes</a></li></ul></li><li><a href="#action-controller">Action Controller</a><ul><li><a href="#shallow-route-nesting">Shallow Route Nesting</a></li> <li><a href="#method-arrays-for-member-or-collection-routes">Method Arrays for Member or Collection Routes</a></li> <li><a href="#resources-with-specific-actions">Resources With Specific Actions</a></li> <li><a href="#other-action-controller-changes">Other Action Controller Changes</a></li></ul></li><li><a href="#action-view">Action View</a></li><li><a href="#action-mailer">Action Mailer</a></li><li><a href="#active-support">Active Support</a><ul><li><a href="#memoization">Memoization</a></li> <li><a href="#each_with_object">each_with_object</a></li> <li><a href="#delegates-with-prefixes">Delegates With Prefixes</a></li> <li><a href="#other-active-support-changes">Other Active Support Changes</a></li></ul></li><li><a href="#railties">Railties</a><ul><li><a href="#config-gems">config.gems</a></li> <li><a href="#other-railties-changes">Other Railties Changes</a></li></ul></li><li><a href="#deprecated">Deprecated</a></li><li><a href="#credits">Credits</a></li></ol></div>
|
106
|
-
</div>
|
107
|
-
</div>
|
108
|
-
|
109
|
-
<div id="container">
|
110
|
-
<div class="wrapper">
|
111
|
-
<div id="mainCol">
|
112
|
-
<h3 id="infrastructure">1 Infrastructure</h3>
|
113
|
-
<p>Rails 2.2 is a significant release for the infrastructure that keeps Rails humming along and connected to the rest of the world.</p>
|
114
|
-
<h4 id="internationalization">1.1 Internationalization</h4>
|
115
|
-
<p>Rails 2.2 supplies an easy system for internationalization (or i18n, for those of you tired of typing).</p>
|
116
|
-
<ul>
|
117
|
-
<li>Lead Contributors: Rails i18 Team</li>
|
118
|
-
<li>More information :
|
119
|
-
<ul>
|
120
|
-
<li><a href="http://rails-i18n.org">Official Rails i18 website</a></li>
|
121
|
-
<li><a href="http://www.artweb-design.de/2008/7/18/finally-ruby-on-rails-gets-internationalized">Finally. Ruby on Rails gets internationalized</a></li>
|
122
|
-
<li><a href="http://github.com/clemens/i18n_demo_app">Localizing Rails : Demo application</a></li>
|
123
|
-
</ul></li>
|
124
|
-
</ul>
|
125
|
-
<h4 id="compatibility-with-ruby-1-9-and-jruby">1.2 Compatibility with Ruby 1.9 and JRuby</h4>
|
126
|
-
<p>Along with thread safety, a lot of work has been done to make Rails work well with JRuby and the upcoming Ruby 1.9. With Ruby 1.9 being a moving target, running edge Rails on edge Ruby is still a hit-or-miss proposition, but Rails is ready to make the transition to Ruby 1.9 when the latter is released.</p>
|
127
|
-
<h3 id="documentation">2 Documentation</h3>
|
128
|
-
<p>The internal documentation of Rails, in the form of code comments, has been improved in numerous places. In addition, the <a href="http://guides.rubyonrails.org/">Ruby on Rails Guides</a> project is the definitive source for information on major Rails components. In its first official release, the Guides page includes:</p>
|
129
|
-
<ul>
|
130
|
-
<li><a href="http://guides.rubyonrails.org/getting_started.html">Getting Started with Rails</a></li>
|
131
|
-
<li><a href="http://guides.rubyonrails.org/migrations.html">Rails Database Migrations</a></li>
|
132
|
-
<li><a href="http://guides.rubyonrails.org/association_basics.html">Active Record Associations</a></li>
|
133
|
-
<li><a href="http://guides.rubyonrails.org/active_record_querying.html">Active Record Query Interface</a></li>
|
134
|
-
<li><a href="http://guides.rubyonrails.org/layouts_and_rendering.html">Layouts and Rendering in Rails</a></li>
|
135
|
-
<li><a href="http://guides.rubyonrails.org/form_helpers.html">Action View Form Helpers</a></li>
|
136
|
-
<li><a href="http://guides.rubyonrails.org/routing.html">Rails Routing from the Outside In</a></li>
|
137
|
-
<li><a href="http://guides.rubyonrails.org/action_controller_overview.html">Action Controller Overview</a></li>
|
138
|
-
<li><a href="http://guides.rubyonrails.org/caching_with_rails.html">Rails Caching</a></li>
|
139
|
-
<li><a href="http://guides.rubyonrails.org/testing.html">A Guide to Testing Rails Applications</a></li>
|
140
|
-
<li><a href="http://guides.rubyonrails.org/security.html">Securing Rails Applications</a></li>
|
141
|
-
<li><a href="http://guides.rubyonrails.org/debugging_rails_applications.html">Debugging Rails Applications</a></li>
|
142
|
-
<li><a href="http://guides.rubyonrails.org/performance_testing.html">Performance Testing Rails Applications</a></li>
|
143
|
-
<li><a href="http://guides.rubyonrails.org/plugins.html">The Basics of Creating Rails Plugins</a></li>
|
144
|
-
</ul>
|
145
|
-
<p>All told, the Guides provide tens of thousands of words of guidance for beginning and intermediate Rails developers.</p>
|
146
|
-
<p>If you want to generate these guides locally, inside your application:</p>
|
147
|
-
<div class="code_container">
|
148
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
149
|
-
rake doc:guides
|
150
|
-
</pre>
|
151
|
-
</div>
|
152
|
-
<p>This will put the guides inside <tt>Rails.root/doc/guides</tt> and you may start surfing straight away by opening <tt>Rails.root/doc/guides/index.html</tt> in your favourite browser.</p>
|
153
|
-
<ul>
|
154
|
-
<li>Lead Contributors: <a href="credits.html">Rails Documentation Team</a></li>
|
155
|
-
<li>Major contributions from <a href="http://advogato.org/person/fxn/diary.html">Xavier Noria</a> and <a href="http://izumi.plan99.net/blog/">Hongli Lai</a>.</li>
|
156
|
-
<li>More information:
|
157
|
-
<ul>
|
158
|
-
<li><a href="http://hackfest.rubyonrails.org/guide">Rails Guides hackfest</a></li>
|
159
|
-
<li><a href="http://weblog.rubyonrails.org/2008/5/2/help-improve-rails-documentation-on-git-branch">Help improve Rails documentation on Git branch</a></li>
|
160
|
-
</ul></li>
|
161
|
-
</ul>
|
162
|
-
<h3 id="better-integration-with-http-out-of-the-box-etag-support">3 Better integration with <span class="caps">HTTP</span> : Out of the box ETag support</h3>
|
163
|
-
<p>Supporting the etag and last modified timestamp in <span class="caps">HTTP</span> headers means that Rails can now send back an empty response if it gets a request for a resource that hasn’t been modified lately. This allows you to check whether a response needs to be sent at all.</p>
|
164
|
-
<div class="code_container">
|
165
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
166
|
-
class ArticlesController < ApplicationController
|
167
|
-
def show_with_respond_to_block
|
168
|
-
@article = Article.find(params[:id])
|
169
|
-
|
170
|
-
# If the request sends headers that differs from the options provided to stale?, then
|
171
|
-
# the request is indeed stale and the respond_to block is triggered (and the options
|
172
|
-
# to the stale? call is set on the response).
|
173
|
-
#
|
174
|
-
# If the request headers match, then the request is fresh and the respond_to block is
|
175
|
-
# not triggered. Instead the default render will occur, which will check the last-modified
|
176
|
-
# and etag headers and conclude that it only needs to send a "304 Not Modified" instead
|
177
|
-
# of rendering the template.
|
178
|
-
if stale?(:last_modified => @article.published_at.utc, :etag => @article)
|
179
|
-
respond_to do |wants|
|
180
|
-
# normal response processing
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
def show_with_implied_render
|
186
|
-
@article = Article.find(params[:id])
|
187
|
-
|
188
|
-
# Sets the response headers and checks them against the request, if the request is stale
|
189
|
-
# (i.e. no match of either etag or last-modified), then the default render of the template happens.
|
190
|
-
# If the request is fresh, then the default render will return a "304 Not Modified"
|
191
|
-
# instead of rendering the template.
|
192
|
-
fresh_when(:last_modified => @article.published_at.utc, :etag => @article)
|
193
|
-
end
|
194
|
-
end
|
195
|
-
</pre>
|
196
|
-
</div>
|
197
|
-
<h3 id="thread-safety">4 Thread Safety</h3>
|
198
|
-
<p>The work done to make Rails thread-safe is rolling out in Rails 2.2. Depending on your web server infrastructure, this means you can handle more requests with fewer copies of Rails in memory, leading to better server performance and higher utilization of multiple cores.</p>
|
199
|
-
<p>To enable multithreaded dispatching in production mode of your application, add the following line in your <tt>config/environments/production.rb</tt>:</p>
|
200
|
-
<div class="code_container">
|
201
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
202
|
-
config.threadsafe!
|
203
|
-
</pre>
|
204
|
-
</div>
|
205
|
-
<ul>
|
206
|
-
<li>More information :
|
207
|
-
<ul>
|
208
|
-
<li><a href="http://m.onkey.org/2008/10/23/thread-safety-for-your-rails">Thread safety for your Rails</a></li>
|
209
|
-
<li><a href="http://weblog.rubyonrails.org/2008/8/16/josh-peek-officially-joins-the-rails-core">Thread safety project announcement</a></li>
|
210
|
-
<li><a href="http://blog.headius.com/2008/08/qa-what-thread-safe-rails-means.html">Q/A: What Thread-safe Rails Means</a></li>
|
211
|
-
</ul></li>
|
212
|
-
</ul>
|
213
|
-
<h3 id="active-record">5 Active Record</h3>
|
214
|
-
<p>There are two big additions to talk about here: transactional migrations and pooled database transactions. There’s also a new (and cleaner) syntax for join table conditions, as well as a number of smaller improvements.</p>
|
215
|
-
<h4 id="transactional-migrations">5.1 Transactional Migrations</h4>
|
216
|
-
<p>Historically, multiple-step Rails migrations have been a source of trouble. If something went wrong during a migration, everything before the error changed the database and everything after the error wasn’t applied. Also, the migration version was stored as having been executed, which means that it couldn’t be simply rerun by <tt>rake db:migrate:redo</tt> after you fix the problem. Transactional migrations change this by wrapping migration steps in a <span class="caps">DDL</span> transaction, so that if any of them fail, the entire migration is undone. In Rails 2.2, transactional migrations are supported on PostgreSQL out of the box. The code is extensible to other database types in the future – and <span class="caps">IBM</span> has already extended it to support the DB2 adapter.</p>
|
217
|
-
<ul>
|
218
|
-
<li>Lead Contributor: <a href="http://adam.blog.heroku.com/">Adam Wiggins</a></li>
|
219
|
-
<li>More information:
|
220
|
-
<ul>
|
221
|
-
<li><a href="http://adam.blog.heroku.com/past/2008/9/3/ddl_transactions/"><span class="caps">DDL</span> Transactions</a></li>
|
222
|
-
<li><a href="http://db2onrails.com/2008/11/08/a-major-milestone-for-db2-on-rails/">A major milestone for DB2 on Rails</a></li>
|
223
|
-
</ul></li>
|
224
|
-
</ul>
|
225
|
-
<h4 id="connection-pooling">5.2 Connection Pooling</h4>
|
226
|
-
<p>Connection pooling lets Rails distribute database requests across a pool of database connections that will grow to a maximum size (by default 5, but you can add a <tt>pool</tt> key to your <tt>database.yml</tt> to adjust this). This helps remove bottlenecks in applications that support many concurrent users. There’s also a <tt>wait_timeout</tt> that defaults to 5 seconds before giving up. <tt>ActiveRecord::Base.connection_pool</tt> gives you direct access to the pool if you need it.</p>
|
227
|
-
<div class="code_container">
|
228
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
229
|
-
development:
|
230
|
-
adapter: mysql
|
231
|
-
username: root
|
232
|
-
database: sample_development
|
233
|
-
pool: 10
|
234
|
-
wait_timeout: 10
|
235
|
-
</pre>
|
236
|
-
</div>
|
237
|
-
<ul>
|
238
|
-
<li>Lead Contributor: <a href="http://blog.nicksieger.com/">Nick Sieger</a></li>
|
239
|
-
<li>More information:
|
240
|
-
<ul>
|
241
|
-
<li><a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-connection-pools">What’s New in Edge Rails: Connection Pools</a></li>
|
242
|
-
</ul></li>
|
243
|
-
</ul>
|
244
|
-
<h4 id="hashes-for-join-table-conditions">5.3 Hashes for Join Table Conditions</h4>
|
245
|
-
<p>You can now specify conditions on join tables using a hash. This is a big help if you need to query across complex joins.</p>
|
246
|
-
<div class="code_container">
|
247
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
248
|
-
class Photo < ActiveRecord::Base
|
249
|
-
belongs_to :product
|
250
|
-
end
|
251
|
-
|
252
|
-
class Product < ActiveRecord::Base
|
253
|
-
has_many :photos
|
254
|
-
end
|
255
|
-
|
256
|
-
# Get all products with copyright-free photos:
|
257
|
-
Product.all(:joins => :photos, :conditions => { :photos => { :copyright => false }})
|
258
|
-
</pre>
|
259
|
-
</div>
|
260
|
-
<ul>
|
261
|
-
<li>More information:
|
262
|
-
<ul>
|
263
|
-
<li><a href="http://ryandaigle.com/articles/2008/7/7/what-s-new-in-edge-rails-easy-join-table-conditions">What’s New in Edge Rails: Easy Join Table Conditions</a></li>
|
264
|
-
</ul></li>
|
265
|
-
</ul>
|
266
|
-
<h4 id="new-dynamic-finders">5.4 New Dynamic Finders</h4>
|
267
|
-
<p>Two new sets of methods have been added to Active Record’s dynamic finders family.</p>
|
268
|
-
<h5 id="find_last_by_-em-attribute-em">5.4.1 <tt>find_last_by_<em>attribute</em></tt></h5>
|
269
|
-
<p>The <tt>find_last_by_<em>attribute</em></tt> method is equivalent to <tt>Model.last(:conditions => {:attribute => value})</tt></p>
|
270
|
-
<div class="code_container">
|
271
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
272
|
-
# Get the last user who signed up from London
|
273
|
-
User.find_last_by_city('London')
|
274
|
-
</pre>
|
275
|
-
</div>
|
276
|
-
<ul>
|
277
|
-
<li>Lead Contributor: <a href="http://www.workingwithrails.com/person/9147-emilio-tagua">Emilio Tagua</a></li>
|
278
|
-
</ul>
|
279
|
-
<h5 id="find_by_-em-attribute-em">5.4.2 <tt>find_by_<em>attribute</em>!</tt></h5>
|
280
|
-
<p>The new bang! version of <tt>find_by_<em>attribute</em>!</tt> is equivalent to <tt>Model.first(:conditions => {:attribute => value}) || raise ActiveRecord::RecordNotFound</tt> Instead of returning <tt>nil</tt> if it can’t find a matching record, this method will raise an exception if it cannot find a match.</p>
|
281
|
-
<div class="code_container">
|
282
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
283
|
-
# Raise ActiveRecord::RecordNotFound exception if 'Moby' hasn't signed up yet!
|
284
|
-
User.find_by_name!('Moby')
|
285
|
-
</pre>
|
286
|
-
</div>
|
287
|
-
<ul>
|
288
|
-
<li>Lead Contributor: <a href="http://blog.hasmanythrough.com">Josh Susser</a></li>
|
289
|
-
</ul>
|
290
|
-
<h4 id="associations-respect-private-protected-scope">5.5 Associations Respect Private/Protected Scope</h4>
|
291
|
-
<p>Active Record association proxies now respect the scope of methods on the proxied object. Previously (given User has_one :account) <tt>@user.account.private_method</tt> would call the private method on the associated Account object. That fails in Rails 2.2; if you need this functionality, you should use <tt>@user.account.send(:private_method)</tt> (or make the method public instead of private or protected). Please note that if you’re overriding <tt>method_missing</tt>, you should also override <tt>respond_to</tt> to match the behavior in order for associations to function normally.</p>
|
292
|
-
<ul>
|
293
|
-
<li>Lead Contributor: Adam Milligan</li>
|
294
|
-
<li>More information:
|
295
|
-
<ul>
|
296
|
-
<li><a href="http://afreshcup.com/2008/10/24/rails-22-change-private-methods-on-association-proxies-are-private/">Rails 2.2 Change: Private Methods on Association Proxies are Private</a></li>
|
297
|
-
</ul></li>
|
298
|
-
</ul>
|
299
|
-
<h4 id="other-activerecord-changes">5.6 Other ActiveRecord Changes</h4>
|
300
|
-
<ul>
|
301
|
-
<li><tt>rake db:migrate:redo</tt> now accepts an optional <span class="caps">VERSION</span> to target that specific migration to redo</li>
|
302
|
-
<li>Set <tt>config.active_record.timestamped_migrations = false</tt> to have migrations with numeric prefix instead of <span class="caps">UTC</span> timestamp.</li>
|
303
|
-
<li>Counter cache columns (for associations declared with <tt>:counter_cache => true</tt>) do not need to be initialized to zero any longer.</li>
|
304
|
-
<li><tt>ActiveRecord::Base.human_name</tt> for an internationalization-aware humane translation of model names</li>
|
305
|
-
</ul>
|
306
|
-
<h3 id="action-controller">6 Action Controller</h3>
|
307
|
-
<p>On the controller side, there are several changes that will help tidy up your routes. There are also some internal changes in the routing engine to lower memory usage on complex applications.</p>
|
308
|
-
<h4 id="shallow-route-nesting">6.1 Shallow Route Nesting</h4>
|
309
|
-
<p>Shallow route nesting provides a solution to the well-known difficulty of using deeply-nested resources. With shallow nesting, you need only supply enough information to uniquely identify the resource that you want to work with.</p>
|
310
|
-
<div class="code_container">
|
311
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
312
|
-
map.resources :publishers, :shallow => true do |publisher|
|
313
|
-
publisher.resources :magazines do |magazine|
|
314
|
-
magazine.resources :photos
|
315
|
-
end
|
316
|
-
end
|
317
|
-
</pre>
|
318
|
-
</div>
|
319
|
-
<p>This will enable recognition of (among others) these routes:</p>
|
320
|
-
<div class="code_container">
|
321
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
322
|
-
/publishers/1 ==> publisher_path(1)
|
323
|
-
/publishers/1/magazines ==> publisher_magazines_path(1)
|
324
|
-
/magazines/2 ==> magazine_path(2)
|
325
|
-
/magazines/2/photos ==> magazines_photos_path(2)
|
326
|
-
/photos/3 ==> photo_path(3)
|
327
|
-
</pre>
|
328
|
-
</div>
|
329
|
-
<ul>
|
330
|
-
<li>Lead Contributor: <a href="http://www.unwwwired.net/">S. Brent Faulkner</a></li>
|
331
|
-
<li>More information:
|
332
|
-
<ul>
|
333
|
-
<li><a href="http://guides.rubyonrails.org/routing.html#_nested_resources">Rails Routing from the Outside In</a></li>
|
334
|
-
<li><a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-shallow-routes">What’s New in Edge Rails: Shallow Routes</a></li>
|
335
|
-
</ul></li>
|
336
|
-
</ul>
|
337
|
-
<h4 id="method-arrays-for-member-or-collection-routes">6.2 Method Arrays for Member or Collection Routes</h4>
|
338
|
-
<p>You can now supply an array of methods for new member or collection routes. This removes the annoyance of having to define a route as accepting any verb as soon as you need it to handle more than one. With Rails 2.2, this is a legitimate route declaration:</p>
|
339
|
-
<div class="code_container">
|
340
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
341
|
-
map.resources :photos, :collection => { :search => [:get, :post] }
|
342
|
-
</pre>
|
343
|
-
</div>
|
344
|
-
<ul>
|
345
|
-
<li>Lead Contributor: <a href="http://brennandunn.com/">Brennan Dunn</a></li>
|
346
|
-
</ul>
|
347
|
-
<h4 id="resources-with-specific-actions">6.3 Resources With Specific Actions</h4>
|
348
|
-
<p>By default, when you use <tt>map.resources</tt> to create a route, Rails generates routes for seven default actions (index, show, create, new, edit, update, and destroy). But each of these routes takes up memory in your application, and causes Rails to generate additional routing logic. Now you can use the <tt>:only</tt> and <tt>:except</tt> options to fine-tune the routes that Rails will generate for resources. You can supply a single action, an array of actions, or the special <tt>:all</tt> or <tt>:none</tt> options. These options are inherited by nested resources.</p>
|
349
|
-
<div class="code_container">
|
350
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
351
|
-
map.resources :photos, :only => [:index, :show]
|
352
|
-
map.resources :products, :except => :destroy
|
353
|
-
</pre>
|
354
|
-
</div>
|
355
|
-
<ul>
|
356
|
-
<li>Lead Contributor: <a href="http://experthuman.com/">Tom Stuart</a></li>
|
357
|
-
</ul>
|
358
|
-
<h4 id="other-action-controller-changes">6.4 Other Action Controller Changes</h4>
|
359
|
-
<ul>
|
360
|
-
<li>You can now easily <a href="http://m.onkey.org/2008/7/20/rescue-from-dispatching">show a custom error page</a> for exceptions raised while routing a request.</li>
|
361
|
-
<li>The <span class="caps">HTTP</span> Accept header is disabled by default now. You should prefer the use of formatted URLs (such as <tt>/customers/1.xml</tt>) to indicate the format that you want. If you need the Accept headers, you can turn them back on with <tt>config.action_controller.use_accept_header = true</tt>.</li>
|
362
|
-
<li>Benchmarking numbers are now reported in milliseconds rather than tiny fractions of seconds</li>
|
363
|
-
<li>Rails now supports <span class="caps">HTTP</span>-only cookies (and uses them for sessions), which help mitigate some cross-site scripting risks in newer browsers.</li>
|
364
|
-
<li><tt>redirect_to</tt> now fully supports <span class="caps">URI</span> schemes (so, for example, you can redirect to a svn+ssh: <span class="caps">URI</span>).</li>
|
365
|
-
<li><tt>render</tt> now supports a <tt>:js</tt> option to render plain vanilla JavaScript with the right mime type.</li>
|
366
|
-
<li>Request forgery protection has been tightened up to apply to <span class="caps">HTML</span>-formatted content requests only.</li>
|
367
|
-
<li>Polymorphic URLs behave more sensibly if a passed parameter is nil. For example, calling <tt>polymorphic_path([@project, @date, @area])</tt> with a nil date will give you <tt>project_area_path</tt>.</li>
|
368
|
-
</ul>
|
369
|
-
<h3 id="action-view">7 Action View</h3>
|
370
|
-
<ul>
|
371
|
-
<li><tt>javascript_include_tag</tt> and <tt>stylesheet_link_tag</tt> support a new <tt>:recursive</tt> option to be used along with <tt>:all</tt>, so that you can load an entire tree of files with a single line of code.</li>
|
372
|
-
<li>The included Prototype JavaScript library has been upgraded to version 1.6.0.3.</li>
|
373
|
-
<li><tt>RJS#page.reload</tt> to reload the browser’s current location via JavaScript</li>
|
374
|
-
<li>The <tt>atom_feed</tt> helper now takes an <tt>:instruct</tt> option to let you insert <span class="caps">XML</span> processing instructions.</li>
|
375
|
-
</ul>
|
376
|
-
<h3 id="action-mailer">8 Action Mailer</h3>
|
377
|
-
<p>Action Mailer now supports mailer layouts. You can make your <span class="caps">HTML</span> emails as pretty as your in-browser views by supplying an appropriately-named layout – for example, the <tt>CustomerMailer</tt> class expects to use <tt>layouts/customer_mailer.html.erb</tt>.</p>
|
378
|
-
<ul>
|
379
|
-
<li>More information:
|
380
|
-
<ul>
|
381
|
-
<li><a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-mailer-layouts">What’s New in Edge Rails: Mailer Layouts</a></li>
|
382
|
-
</ul></li>
|
383
|
-
</ul>
|
384
|
-
<p>Action Mailer now offers built-in support for GMail’s <span class="caps">SMTP</span> servers, by turning on <span class="caps">STARTTLS</span> automatically. This requires Ruby 1.8.7 to be installed.</p>
|
385
|
-
<h3 id="active-support">9 Active Support</h3>
|
386
|
-
<p>Active Support now offers built-in memoization for Rails applications, the <tt>each_with_object</tt> method, prefix support on delegates, and various other new utility methods.</p>
|
387
|
-
<h4 id="memoization">9.1 Memoization</h4>
|
388
|
-
<p>Memoization is a pattern of initializing a method once and then stashing its value away for repeat use. You’ve probably used this pattern in your own applications:</p>
|
389
|
-
<div class="code_container">
|
390
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
391
|
-
def full_name
|
392
|
-
@full_name ||= "#{first_name} #{last_name}"
|
393
|
-
end
|
394
|
-
</pre>
|
395
|
-
</div>
|
396
|
-
<p>Memoization lets you handle this task in a declarative fashion:</p>
|
397
|
-
<div class="code_container">
|
398
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
399
|
-
extend ActiveSupport::Memoizable
|
400
|
-
|
401
|
-
def full_name
|
402
|
-
"#{first_name} #{last_name}"
|
403
|
-
end
|
404
|
-
memoize :full_name
|
405
|
-
</pre>
|
406
|
-
</div>
|
407
|
-
<p>Other features of memoization include <tt>unmemoize</tt>, <tt>unmemoize_all</tt>, and <tt>memoize_all</tt> to turn memoization on or off.</p>
|
408
|
-
<ul>
|
409
|
-
<li>Lead Contributor: <a href="http://joshpeek.com/">Josh Peek</a></li>
|
410
|
-
<li>More information:
|
411
|
-
<ul>
|
412
|
-
<li><a href="http://ryandaigle.com/articles/2008/7/16/what-s-new-in-edge-rails-memoization">What’s New in Edge Rails: Easy Memoization</a></li>
|
413
|
-
<li><a href="http://www.railway.at/articles/2008/09/20/a-guide-to-memoization">Memo-what? A Guide to Memoization</a></li>
|
414
|
-
</ul></li>
|
415
|
-
</ul>
|
416
|
-
<h4 id="each_with_object">9.2 each_with_object</h4>
|
417
|
-
<p>The <tt>each_with_object</tt> method provides an alternative to <tt>inject</tt>, using a method backported from Ruby 1.9. It iterates over a collection, passing the current element and the memo into the block.</p>
|
418
|
-
<div class="code_container">
|
419
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
420
|
-
%w(foo bar).each_with_object({}) { |str, hsh| hsh[str] = str.upcase } #=> {'foo' => 'FOO', 'bar' => 'BAR'}
|
421
|
-
</pre>
|
422
|
-
</div>
|
423
|
-
<p>Lead Contributor: <a href="http://therealadam.com/">Adam Keys</a></p>
|
424
|
-
<h4 id="delegates-with-prefixes">9.3 Delegates With Prefixes</h4>
|
425
|
-
<p>If you delegate behavior from one class to another, you can now specify a prefix that will be used to identify the delegated methods. For example:</p>
|
426
|
-
<div class="code_container">
|
427
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
428
|
-
class Vendor < ActiveRecord::Base
|
429
|
-
has_one :account
|
430
|
-
delegate :email, :password, :to => :account, :prefix => true
|
431
|
-
end
|
432
|
-
</pre>
|
433
|
-
</div>
|
434
|
-
<p>This will produce delegated methods <tt>vendor#account_email</tt> and <tt>vendor#account_password</tt>. You can also specify a custom prefix:</p>
|
435
|
-
<div class="code_container">
|
436
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
437
|
-
class Vendor < ActiveRecord::Base
|
438
|
-
has_one :account
|
439
|
-
delegate :email, :password, :to => :account, :prefix => :owner
|
440
|
-
end
|
441
|
-
</pre>
|
442
|
-
</div>
|
443
|
-
<p>This will produce delegated methods <tt>vendor#owner_email</tt> and <tt>vendor#owner_password</tt>.</p>
|
444
|
-
<p>Lead Contributor: <a href="http://workingwithrails.com/person/5830-daniel-schierbeck">Daniel Schierbeck</a></p>
|
445
|
-
<h4 id="other-active-support-changes">9.4 Other Active Support Changes</h4>
|
446
|
-
<ul>
|
447
|
-
<li>Extensive updates to <tt>ActiveSupport::Multibyte</tt>, including Ruby 1.9 compatibility fixes.</li>
|
448
|
-
<li>The addition of <tt>ActiveSupport::Rescuable</tt> allows any class to mix in the <tt>rescue_from</tt> syntax.</li>
|
449
|
-
<li><tt>past?</tt>, <tt>today?</tt> and <tt>future?</tt> for <tt>Date</tt> and <tt>Time</tt> classes to facilitate date/time comparisons.</li>
|
450
|
-
<li><tt>Array#second</tt> through <tt>Array#fifth</tt> as aliases for <tt>Array#[1]</tt> through <tt>Array#[4]</tt></li>
|
451
|
-
<li><tt>Enumerable#many?</tt> to encapsulate <tt>collection.size > 1</tt></li>
|
452
|
-
<li><tt>Inflector#parameterize</tt> produces a <span class="caps">URL</span>-ready version of its input, for use in <tt>to_param</tt>.</li>
|
453
|
-
<li><tt>Time#advance</tt> recognizes fractional days and weeks, so you can do <tt>1.7.weeks.ago</tt>, <tt>1.5.hours.since</tt>, and so on.</li>
|
454
|
-
<li>The included TzInfo library has been upgraded to version 0.3.12.</li>
|
455
|
-
<li><tt>ActiveSuport::StringInquirer</tt> gives you a pretty way to test for equality in strings: <tt>ActiveSupport::StringInquirer.new("abc").abc? => true</tt></li>
|
456
|
-
</ul>
|
457
|
-
<h3 id="railties">10 Railties</h3>
|
458
|
-
<p>In Railties (the core code of Rails itself) the biggest changes are in the <tt>config.gems</tt> mechanism.</p>
|
459
|
-
<h4 id="config-gems">10.1 config.gems</h4>
|
460
|
-
<p>To avoid deployment issues and make Rails applications more self-contained, it’s possible to place copies of all of the gems that your Rails application requires in <tt>/vendor/gems</tt>. This capability first appeared in Rails 2.1, but it’s much more flexible and robust in Rails 2.2, handling complicated dependencies between gems. Gem management in Rails includes these commands:</p>
|
461
|
-
<ul>
|
462
|
-
<li><tt>config.gem _gem_name_</tt> in your <tt>config/environment.rb</tt> file</li>
|
463
|
-
<li><tt>rake gems</tt> to list all configured gems, as well as whether they (and their dependencies) are installed, frozen, or framework (framework gems are those loaded by Rails before the gem dependency code is executed; such gems cannot be frozen)</li>
|
464
|
-
<li><tt>rake gems:install</tt> to install missing gems to the computer</li>
|
465
|
-
<li><tt>rake gems:unpack</tt> to place a copy of the required gems into <tt>/vendor/gems</tt></li>
|
466
|
-
<li><tt>rake gems:unpack:dependencies</tt> to get copies of the required gems and their dependencies into <tt>/vendor/gems</tt></li>
|
467
|
-
<li><tt>rake gems:build</tt> to build any missing native extensions</li>
|
468
|
-
<li><tt>rake gems:refresh_specs</tt> to bring vendored gems created with Rails 2.1 into alignment with the Rails 2.2 way of storing them</li>
|
469
|
-
</ul>
|
470
|
-
<p>You can unpack or install a single gem by specifying <tt>GEM=_gem_name_</tt> on the command line.</p>
|
471
|
-
<ul>
|
472
|
-
<li>Lead Contributor: <a href="http://github.com/al2o3cr">Matt Jones</a></li>
|
473
|
-
<li>More information:
|
474
|
-
<ul>
|
475
|
-
<li><a href="http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies">What’s New in Edge Rails: Gem Dependencies</a></li>
|
476
|
-
<li><a href="http://afreshcup.com/2008/10/25/rails-212-and-22rc1-update-your-rubygems/">Rails 2.1.2 and 2.2RC1: Update Your RubyGems</a></li>
|
477
|
-
<li><a href="http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1128">Detailed discussion on Lighthouse</a></li>
|
478
|
-
</ul></li>
|
479
|
-
</ul>
|
480
|
-
<h4 id="other-railties-changes">10.2 Other Railties Changes</h4>
|
481
|
-
<ul>
|
482
|
-
<li>If you’re a fan of the <a href="http://code.macournoyer.com/thin/">Thin</a> web server, you’ll be happy to know that <tt>script/server</tt> now supports Thin directly.</li>
|
483
|
-
<li><tt>script/plugin install <plugin> -r <revision></tt> now works with git-based as well as svn-based plugins.</li>
|
484
|
-
<li><tt>script/console</tt> now supports a <tt>--debugger</tt> option</li>
|
485
|
-
<li>Instructions for setting up a continuous integration server to build Rails itself are included in the Rails source</li>
|
486
|
-
<li><tt>rake notes:custom ANNOTATION=MYFLAG</tt> lets you list out custom annotations.</li>
|
487
|
-
<li>Wrapped <tt>Rails.env</tt> in <tt>StringInquirer</tt> so you can do <tt>Rails.env.development?</tt></li>
|
488
|
-
<li>To eliminate deprecation warnings and properly handle gem dependencies, Rails now requires rubygems 1.3.1 or higher.</li>
|
489
|
-
</ul>
|
490
|
-
<h3 id="deprecated">11 Deprecated</h3>
|
491
|
-
<p>A few pieces of older code are deprecated in this release:</p>
|
492
|
-
<ul>
|
493
|
-
<li><tt>Rails::SecretKeyGenerator</tt> has been replaced by <tt>ActiveSupport::SecureRandom</tt></li>
|
494
|
-
<li><tt>render_component</tt> is deprecated. There’s a <a href="http://github.com/rails/render_component/tree/master">render_components plugin</a> available if you need this functionality.</li>
|
495
|
-
<li>Implicit local assignments when rendering partials has been deprecated.</li>
|
496
|
-
</ul>
|
497
|
-
<div class="code_container">
|
498
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
499
|
-
def partial_with_implicit_local_assignment
|
500
|
-
@customer = Customer.new("Marcel")
|
501
|
-
render :partial => "customer"
|
502
|
-
end
|
503
|
-
</pre>
|
504
|
-
</div>
|
505
|
-
<p>Previously the above code made available a local variable called <tt>customer</tt> inside the partial ‘customer’. You should explicitly pass all the variables via :locals hash now.</p>
|
506
|
-
<ul>
|
507
|
-
<li><tt>country_select</tt> has been removed. See the <a href="http://www.rubyonrails.org/deprecation/list-of-countries">deprecation page</a> for more information and a plugin replacement.</li>
|
508
|
-
<li><tt>ActiveRecord::Base.allow_concurrency</tt> no longer has any effect.</li>
|
509
|
-
<li><tt>ActiveRecord::Errors.default_error_messages</tt> has been deprecated in favor of <tt>I18n.translate('activerecord.errors.messages')</tt></li>
|
510
|
-
<li>The <tt>%s</tt> and <tt>%d</tt> interpolation syntax for internationalization is deprecated.</li>
|
511
|
-
<li><tt>String#chars</tt> has been deprecated in favor of <tt>String#mb_chars</tt>.</li>
|
512
|
-
<li>Durations of fractional months or fractional years are deprecated. Use Ruby’s core <tt>Date</tt> and <tt>Time</tt> class arithmetic instead.</li>
|
513
|
-
<li><tt>Request#relative_url_root</tt> is deprecated. Use <tt>ActionController::Base.relative_url_root</tt> instead.</li>
|
514
|
-
</ul>
|
515
|
-
<h3 id="credits">12 Credits</h3>
|
516
|
-
<p>Release notes compiled by <a href="http://afreshcup.com">Mike Gunderloy</a></p>
|
517
|
-
|
518
|
-
<h3>Feedback</h3>
|
519
|
-
<p>
|
520
|
-
You're encouraged to help improve the quality of this guide.
|
521
|
-
</p>
|
522
|
-
<p>
|
523
|
-
If you see any typos or factual errors you are confident to
|
524
|
-
patch, please clone <a href="https://github.com/lifo/docrails">docrails</a>
|
525
|
-
and push the change yourself. That branch of Rails has public write access.
|
526
|
-
Commits are still reviewed, but that happens after you've submitted your
|
527
|
-
contribution. <a href="https://github.com/lifo/docrails">docrails</a> is
|
528
|
-
cross-merged with master periodically.
|
529
|
-
</p>
|
530
|
-
<p>
|
531
|
-
You may also find incomplete content, or stuff that is not up to date.
|
532
|
-
Please do add any missing documentation for master. Check the
|
533
|
-
<a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a>
|
534
|
-
for style and conventions.
|
535
|
-
</p>
|
536
|
-
<p>
|
537
|
-
If for whatever reason you spot something to fix but cannot patch it yourself, please
|
538
|
-
<a href="https://github.com/rails/rails/issues">open an issue</a>.
|
539
|
-
</p>
|
540
|
-
<p>And last but not least, any kind of discussion regarding Ruby on Rails
|
541
|
-
documentation is very welcome in the <a href="http://groups.google.com/group/rubyonrails-docs">rubyonrails-docs mailing list</a>.
|
542
|
-
</p>
|
543
|
-
</div>
|
544
|
-
</div>
|
545
|
-
</div>
|
546
|
-
|
547
|
-
<hr class="hide" />
|
548
|
-
<div id="footer">
|
549
|
-
<div class="wrapper">
|
550
|
-
<p>This work is licensed under a <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0</a> License</p>
|
551
|
-
<p>"Rails", "Ruby on Rails", and the Rails logo are trademarks of David Heinemeier Hansson. All rights reserved.</p>
|
552
|
-
</div>
|
553
|
-
</div>
|
554
|
-
|
555
|
-
<script type="text/javascript" src="javascripts/guides.js"></script>
|
556
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shCore.js"></script>
|
557
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushRuby.js"></script>
|
558
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushXml.js"></script>
|
559
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushSql.js"></script>
|
560
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushPlain.js"></script>
|
561
|
-
<script type="text/javascript">
|
562
|
-
SyntaxHighlighter.all()
|
563
|
-
</script>
|
564
|
-
</body>
|
565
|
-
</html>
|