rails 4.2.0.beta4 → 4.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/guides/Rakefile +3 -1
- data/guides/bug_report_templates/action_controller_gem.rb +2 -2
- data/guides/bug_report_templates/action_controller_master.rb +2 -2
- data/guides/source/3_0_release_notes.md +2 -2
- data/guides/source/4_1_release_notes.md +1 -1
- data/guides/source/4_2_release_notes.md +250 -225
- data/guides/source/_welcome.html.erb +1 -1
- data/guides/source/action_controller_overview.md +6 -6
- data/guides/source/action_mailer_basics.md +26 -11
- data/guides/source/action_view_overview.md +0 -1
- data/guides/source/active_job_basics.md +29 -23
- data/guides/source/active_record_postgresql.md +2 -7
- data/guides/source/active_record_validations.md +1 -0
- data/guides/source/active_support_core_extensions.md +1 -1
- data/guides/source/active_support_instrumentation.md +5 -5
- data/guides/source/asset_pipeline.md +2 -2
- data/guides/source/association_basics.md +0 -2
- data/guides/source/command_line.md +6 -15
- data/guides/source/configuring.md +4 -4
- data/guides/source/documents.yaml +0 -1
- data/guides/source/engines.md +26 -15
- data/guides/source/form_helpers.md +10 -2
- data/guides/source/getting_started.md +9 -9
- data/guides/source/rails_on_rack.md +2 -2
- data/guides/source/ruby_on_rails_guides_guidelines.md +1 -0
- data/guides/source/security.md +1 -1
- data/guides/source/testing.md +80 -13
- data/guides/source/upgrading_ruby_on_rails.md +23 -20
- metadata +29 -229
- data/guides/output/2_2_release_notes.html +0 -724
- data/guides/output/2_3_release_notes.html +0 -870
- data/guides/output/3_0_release_notes.html +0 -773
- data/guides/output/3_1_release_notes.html +0 -740
- data/guides/output/3_2_release_notes.html +0 -797
- data/guides/output/4_0_release_notes.html +0 -523
- data/guides/output/4_1_release_notes.html +0 -806
- data/guides/output/4_2_release_notes.html +0 -728
- data/guides/output/Gemfile +0 -6
- data/guides/output/_license.html +0 -226
- data/guides/output/_welcome.html +0 -233
- data/guides/output/action_controller_overview.html +0 -1335
- data/guides/output/action_mailer_basics.html +0 -928
- data/guides/output/action_view_overview.html +0 -1509
- data/guides/output/active_job_basics.html +0 -546
- data/guides/output/active_model_basics.html +0 -438
- data/guides/output/active_record_basics.html +0 -594
- data/guides/output/active_record_callbacks.html +0 -592
- data/guides/output/active_record_migrations.html +0 -1123
- data/guides/output/active_record_postgresql.html +0 -675
- data/guides/output/active_record_querying.html +0 -1796
- data/guides/output/active_record_validations.html +0 -1301
- data/guides/output/active_support_core_extensions.html +0 -3450
- data/guides/output/active_support_instrumentation.html +0 -1121
- data/guides/output/api_documentation_guidelines.html +0 -498
- data/guides/output/asset_pipeline.html +0 -1167
- data/guides/output/association_basics.html +0 -2086
- data/guides/output/caching_with_rails.html +0 -553
- data/guides/output/command_line.html +0 -791
- data/guides/output/configuring.html +0 -1055
- data/guides/output/contributing_to_ruby_on_rails.html +0 -657
- data/guides/output/credits.html +0 -284
- data/guides/output/debugging_rails_applications.html +0 -1014
- data/guides/output/development_dependencies_install.html +0 -478
- data/guides/output/engines.html +0 -1438
- data/guides/output/form_helpers.html +0 -1074
- data/guides/output/generators.html +0 -838
- data/guides/output/getting_started.html +0 -2092
- data/guides/output/i18n.html +0 -1198
- data/guides/output/images/akshaysurve.jpg +0 -0
- 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/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/edge_badge.png +0 -0
- data/guides/output/images/favicon.ico +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/getting_started/article_with_comments.png +0 -0
- data/guides/output/images/getting_started/challenge.png +0 -0
- data/guides/output/images/getting_started/confirm_dialog.png +0 -0
- data/guides/output/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
- data/guides/output/images/getting_started/forbidden_attributes_for_new_post.png +0 -0
- data/guides/output/images/getting_started/form_with_errors.png +0 -0
- data/guides/output/images/getting_started/index_action_with_edit_link.png +0 -0
- data/guides/output/images/getting_started/new_article.png +0 -0
- data/guides/output/images/getting_started/new_post.png +0 -0
- data/guides/output/images/getting_started/post_with_comments.png +0 -0
- data/guides/output/images/getting_started/rails_welcome.png +0 -0
- data/guides/output/images/getting_started/routing_error_no_controller.png +0 -0
- data/guides/output/images/getting_started/routing_error_no_route_matches.png +0 -0
- data/guides/output/images/getting_started/show_action_for_articles.png +0 -0
- data/guides/output/images/getting_started/show_action_for_posts.png +0 -0
- data/guides/output/images/getting_started/template_is_missing_articles_new.png +0 -0
- data/guides/output/images/getting_started/template_is_missing_posts_new.png +0 -0
- data/guides/output/images/getting_started/undefined_method_post_path.png +0 -0
- data/guides/output/images/getting_started/unknown_action_create_for_articles.png +0 -0
- data/guides/output/images/getting_started/unknown_action_create_for_posts.png +0 -0
- data/guides/output/images/getting_started/unknown_action_new_for_articles.png +0 -0
- data/guides/output/images/getting_started/unknown_action_new_for_posts.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/nav_arrow.gif +0 -0
- data/guides/output/images/oscardelben.jpg +0 -0
- data/guides/output/images/polymorphic.png +0 -0
- data/guides/output/images/radar.png +0 -0
- data/guides/output/images/rails4_features.png +0 -0
- data/guides/output/images/rails_guides_kindle_cover.jpg +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/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/vijaydev.jpg +0 -0
- data/guides/output/index.html +0 -354
- data/guides/output/initialization.html +0 -876
- data/guides/output/javascripts/guides.js +0 -59
- data/guides/output/javascripts/jquery.min.js +0 -4
- data/guides/output/javascripts/responsive-tables.js +0 -43
- 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 -448
- data/guides/output/layouts_and_rendering.html +0 -1541
- data/guides/output/maintenance_policy.html +0 -257
- data/guides/output/migrations.html +0 -1360
- data/guides/output/nested_model_forms.html +0 -412
- data/guides/output/plugins.html +0 -644
- data/guides/output/rails_application_templates.html +0 -450
- data/guides/output/rails_on_rack.html +0 -547
- data/guides/output/routing.html +0 -1631
- data/guides/output/ruby_on_rails_guides_guidelines.html +0 -329
- data/guides/output/security.html +0 -935
- data/guides/output/stylesheets/fixes.css +0 -16
- data/guides/output/stylesheets/kindle.css +0 -11
- data/guides/output/stylesheets/main.css +0 -713
- data/guides/output/stylesheets/print.css +0 -52
- data/guides/output/stylesheets/reset.css +0 -43
- data/guides/output/stylesheets/responsive-tables.css +0 -50
- 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 -1350
- data/guides/output/upgrading_ruby_on_rails.html +0 -1135
- data/guides/output/working_with_javascript_in_rails.html +0 -587
@@ -1,773 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
7
|
-
|
8
|
-
<title>Ruby on Rails 3.0 Release Notes — Ruby on Rails Guides</title>
|
9
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
|
10
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
|
11
|
-
|
12
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shCore.css" />
|
13
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shThemeRailsGuides.css" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/fixes.css" />
|
16
|
-
|
17
|
-
<link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
|
18
|
-
</head>
|
19
|
-
<body class="guide">
|
20
|
-
<div id="topNav">
|
21
|
-
<div class="wrapper">
|
22
|
-
<strong class="more-info-label">More at <a href="http://rubyonrails.org/">rubyonrails.org:</a> </strong>
|
23
|
-
<span class="red-button more-info-button">
|
24
|
-
More Ruby on Rails
|
25
|
-
</span>
|
26
|
-
<ul class="more-info-links s-hidden">
|
27
|
-
<li class="more-info"><a href="http://rubyonrails.org/">Overview</a></li>
|
28
|
-
<li class="more-info"><a href="http://rubyonrails.org/download">Download</a></li>
|
29
|
-
<li class="more-info"><a href="http://rubyonrails.org/deploy">Deploy</a></li>
|
30
|
-
<li class="more-info"><a href="https://github.com/rails/rails">Code</a></li>
|
31
|
-
<li class="more-info"><a href="http://rubyonrails.org/screencasts">Screencasts</a></li>
|
32
|
-
<li class="more-info"><a href="http://rubyonrails.org/documentation">Documentation</a></li>
|
33
|
-
<li class="more-info"><a href="http://rubyonrails.org/community">Community</a></li>
|
34
|
-
<li class="more-info"><a href="http://weblog.rubyonrails.org/">Blog</a></li>
|
35
|
-
</ul>
|
36
|
-
</div>
|
37
|
-
</div>
|
38
|
-
<div id="header">
|
39
|
-
<div class="wrapper clearfix">
|
40
|
-
<h1><a href="index.html" title="Return to home page">Guides.rubyonrails.org</a></h1>
|
41
|
-
<ul class="nav">
|
42
|
-
<li><a class="nav-item" href="index.html">Home</a></li>
|
43
|
-
<li class="guides-index guides-index-large">
|
44
|
-
<a href="index.html" id="guidesMenu" class="guides-index-item nav-item">Guides Index</a>
|
45
|
-
<div id="guides" class="clearfix" style="display: none;">
|
46
|
-
<hr />
|
47
|
-
<dl class="L">
|
48
|
-
<dt>Start Here</dt>
|
49
|
-
<dd><a href="getting_started.html">Getting Started with Rails</a></dd>
|
50
|
-
<dt>Models</dt>
|
51
|
-
<dd><a href="active_record_basics.html">Active Record Basics</a></dd>
|
52
|
-
<dd><a href="active_record_migrations.html">Active Record Migrations</a></dd>
|
53
|
-
<dd><a href="active_record_validations.html">Active Record Validations</a></dd>
|
54
|
-
<dd><a href="active_record_callbacks.html">Active Record Callbacks</a></dd>
|
55
|
-
<dd><a href="association_basics.html">Active Record Associations</a></dd>
|
56
|
-
<dd><a href="active_record_querying.html">Active Record Query Interface</a></dd>
|
57
|
-
<dt>Views</dt>
|
58
|
-
<dd><a href="layouts_and_rendering.html">Layouts and Rendering in Rails</a></dd>
|
59
|
-
<dd><a href="form_helpers.html">Action View Form Helpers</a></dd>
|
60
|
-
<dt>Controllers</dt>
|
61
|
-
<dd><a href="action_controller_overview.html">Action Controller Overview</a></dd>
|
62
|
-
<dd><a href="routing.html">Rails Routing from the Outside In</a></dd>
|
63
|
-
</dl>
|
64
|
-
<dl class="R">
|
65
|
-
<dt>Digging Deeper</dt>
|
66
|
-
<dd><a href="active_support_core_extensions.html">Active Support Core Extensions</a></dd>
|
67
|
-
<dd><a href="i18n.html">Rails Internationalization API</a></dd>
|
68
|
-
<dd><a href="action_mailer_basics.html">Action Mailer Basics</a></dd>
|
69
|
-
<dd><a href="active_job_basics.html">Active Job Basics</a></dd>
|
70
|
-
<dd><a href="security.html">Securing Rails Applications</a></dd>
|
71
|
-
<dd><a href="debugging_rails_applications.html">Debugging Rails Applications</a></dd>
|
72
|
-
<dd><a href="configuring.html">Configuring Rails Applications</a></dd>
|
73
|
-
<dd><a href="command_line.html">Rails Command Line Tools and Rake Tasks</a></dd>
|
74
|
-
<dd><a href="asset_pipeline.html">Asset Pipeline</a></dd>
|
75
|
-
<dd><a href="working_with_javascript_in_rails.html">Working with JavaScript in Rails</a></dd>
|
76
|
-
<dt>Extending Rails</dt>
|
77
|
-
<dd><a href="rails_on_rack.html">Rails on Rack</a></dd>
|
78
|
-
<dd><a href="generators.html">Creating and Customizing Rails Generators</a></dd>
|
79
|
-
<dt>Contributing to Ruby on Rails</dt>
|
80
|
-
<dd><a href="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</a></dd>
|
81
|
-
<dd><a href="api_documentation_guidelines.html">API Documentation Guidelines</a></dd>
|
82
|
-
<dd><a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a></dd>
|
83
|
-
<dt>Maintenance Policy</dt>
|
84
|
-
<dd><a href="maintenance_policy.html">Maintenance Policy</a></dd>
|
85
|
-
<dt>Release Notes</dt>
|
86
|
-
<dd><a href="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</a></dd>
|
87
|
-
<dd><a href="4_1_release_notes.html">Ruby on Rails 4.1 Release Notes</a></dd>
|
88
|
-
<dd><a href="4_0_release_notes.html">Ruby on Rails 4.0 Release Notes</a></dd>
|
89
|
-
<dd><a href="3_2_release_notes.html">Ruby on Rails 3.2 Release Notes</a></dd>
|
90
|
-
<dd><a href="3_1_release_notes.html">Ruby on Rails 3.1 Release Notes</a></dd>
|
91
|
-
<dd><a href="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</a></dd>
|
92
|
-
<dd><a href="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</a></dd>
|
93
|
-
<dd><a href="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</a></dd>
|
94
|
-
</dl>
|
95
|
-
</div>
|
96
|
-
</li>
|
97
|
-
<li><a class="nav-item" href="contributing_to_ruby_on_rails.html">Contribute</a></li>
|
98
|
-
<li><a class="nav-item" href="credits.html">Credits</a></li>
|
99
|
-
<li class="guides-index guides-index-small">
|
100
|
-
<select class="guides-index-item nav-item">
|
101
|
-
<option value="index.html">Guides Index</option>
|
102
|
-
<optgroup label="Start Here">
|
103
|
-
<option value="getting_started.html">Getting Started with Rails</option>
|
104
|
-
</optgroup>
|
105
|
-
<optgroup label="Models">
|
106
|
-
<option value="active_record_basics.html">Active Record Basics</option>
|
107
|
-
<option value="active_record_migrations.html">Active Record Migrations</option>
|
108
|
-
<option value="active_record_validations.html">Active Record Validations</option>
|
109
|
-
<option value="active_record_callbacks.html">Active Record Callbacks</option>
|
110
|
-
<option value="association_basics.html">Active Record Associations</option>
|
111
|
-
<option value="active_record_querying.html">Active Record Query Interface</option>
|
112
|
-
</optgroup>
|
113
|
-
<optgroup label="Views">
|
114
|
-
<option value="layouts_and_rendering.html">Layouts and Rendering in Rails</option>
|
115
|
-
<option value="form_helpers.html">Action View Form Helpers</option>
|
116
|
-
</optgroup>
|
117
|
-
<optgroup label="Controllers">
|
118
|
-
<option value="action_controller_overview.html">Action Controller Overview</option>
|
119
|
-
<option value="routing.html">Rails Routing from the Outside In</option>
|
120
|
-
</optgroup>
|
121
|
-
<optgroup label="Digging Deeper">
|
122
|
-
<option value="active_support_core_extensions.html">Active Support Core Extensions</option>
|
123
|
-
<option value="i18n.html">Rails Internationalization API</option>
|
124
|
-
<option value="action_mailer_basics.html">Action Mailer Basics</option>
|
125
|
-
<option value="active_job_basics.html">Active Job Basics</option>
|
126
|
-
<option value="security.html">Securing Rails Applications</option>
|
127
|
-
<option value="debugging_rails_applications.html">Debugging Rails Applications</option>
|
128
|
-
<option value="configuring.html">Configuring Rails Applications</option>
|
129
|
-
<option value="command_line.html">Rails Command Line Tools and Rake Tasks</option>
|
130
|
-
<option value="asset_pipeline.html">Asset Pipeline</option>
|
131
|
-
<option value="working_with_javascript_in_rails.html">Working with JavaScript in Rails</option>
|
132
|
-
</optgroup>
|
133
|
-
<optgroup label="Extending Rails">
|
134
|
-
<option value="rails_on_rack.html">Rails on Rack</option>
|
135
|
-
<option value="generators.html">Creating and Customizing Rails Generators</option>
|
136
|
-
</optgroup>
|
137
|
-
<optgroup label="Contributing to Ruby on Rails">
|
138
|
-
<option value="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</option>
|
139
|
-
<option value="api_documentation_guidelines.html">API Documentation Guidelines</option>
|
140
|
-
<option value="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</option>
|
141
|
-
</optgroup>
|
142
|
-
<optgroup label="Maintenance Policy">
|
143
|
-
<option value="maintenance_policy.html">Maintenance Policy</option>
|
144
|
-
</optgroup>
|
145
|
-
<optgroup label="Release Notes">
|
146
|
-
<option value="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</option>
|
147
|
-
<option value="4_1_release_notes.html">Ruby on Rails 4.1 Release Notes</option>
|
148
|
-
<option value="4_0_release_notes.html">Ruby on Rails 4.0 Release Notes</option>
|
149
|
-
<option value="3_2_release_notes.html">Ruby on Rails 3.2 Release Notes</option>
|
150
|
-
<option value="3_1_release_notes.html">Ruby on Rails 3.1 Release Notes</option>
|
151
|
-
<option value="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</option>
|
152
|
-
<option value="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</option>
|
153
|
-
<option value="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</option>
|
154
|
-
</optgroup>
|
155
|
-
</select>
|
156
|
-
</li>
|
157
|
-
</ul>
|
158
|
-
</div>
|
159
|
-
</div>
|
160
|
-
<hr class="hide" />
|
161
|
-
|
162
|
-
<div id="feature">
|
163
|
-
<div class="wrapper">
|
164
|
-
<h2>Ruby on Rails 3.0 Release Notes</h2><p>Rails 3.0 is ponies and rainbows! It's going to cook you dinner and fold your laundry. You're going to wonder how life was ever possible before it arrived. It's the Best Version of Rails We've Ever Done!</p><p>But seriously now, it's really good stuff. There are all the good ideas brought over from when the Merb team joined the party and brought a focus on framework agnosticism, slimmer and faster internals, and a handful of tasty APIs. If you're coming to Rails 3.0 from Merb 1.x, you should recognize lots. If you're coming from Rails 2.x, you're going to love it too.</p><p>Even if you don't give a hoot about any of our internal cleanups, Rails 3.0 is going to delight. We have a bunch of new features and improved APIs. It's never been a better time to be a Rails developer. Some of the highlights are:</p>
|
165
|
-
<ul>
|
166
|
-
<li>Brand new router with an emphasis on RESTful declarations</li>
|
167
|
-
<li>New Action Mailer API modeled after Action Controller (now without the agonizing pain of sending multipart messages!)</li>
|
168
|
-
<li>New Active Record chainable query language built on top of relational algebra</li>
|
169
|
-
<li>Unobtrusive JavaScript helpers with drivers for Prototype, jQuery, and more coming (end of inline JS)</li>
|
170
|
-
<li>Explicit dependency management with Bundler</li>
|
171
|
-
</ul>
|
172
|
-
<p>On top of all that, we've tried our best to deprecate the old APIs with nice warnings. That means that you can move your existing application to Rails 3 without immediately rewriting all your old code to the latest best practices.</p><p>These release notes cover the major upgrades, but don't include every little bug fix and change. Rails 3.0 consists of almost 4,000 commits by more than 250 authors! 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>
|
173
|
-
|
174
|
-
<div id="subCol">
|
175
|
-
<h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
|
176
|
-
<ol class="chapters">
|
177
|
-
<li>
|
178
|
-
<a href="#upgrading-to-rails-3">Upgrading to Rails 3</a>
|
179
|
-
|
180
|
-
<ul>
|
181
|
-
<li><a href="#rails-3-requires-at-least-ruby-1.8.7">Rails 3 requires at least Ruby 1.8.7</a></li>
|
182
|
-
<li><a href="#rails-application-object">Rails Application object</a></li>
|
183
|
-
<li><a href="#script/*-replaced-by-script/rails">script/* replaced by script/rails</a></li>
|
184
|
-
<li><a href="#dependencies-and-config.gem">Dependencies and config.gem</a></li>
|
185
|
-
<li><a href="#upgrade-process">Upgrade Process</a></li>
|
186
|
-
</ul>
|
187
|
-
</li>
|
188
|
-
<li>
|
189
|
-
<a href="#creating-a-rails-3.0-application">Creating a Rails 3.0 application</a>
|
190
|
-
|
191
|
-
<ul>
|
192
|
-
<li><a href="#vendoring-gems">Vendoring Gems</a></li>
|
193
|
-
<li><a href="#living-on-the-edge">Living on the Edge</a></li>
|
194
|
-
</ul>
|
195
|
-
</li>
|
196
|
-
<li>
|
197
|
-
<a href="#rails-architectural-changes">Rails Architectural Changes</a>
|
198
|
-
|
199
|
-
<ul>
|
200
|
-
<li><a href="#railties-restrung">Railties Restrung</a></li>
|
201
|
-
<li><a href="#all-rails-core-components-are-decoupled">All Rails core components are decoupled</a></li>
|
202
|
-
<li><a href="#active-model-abstraction">Active Model Abstraction</a></li>
|
203
|
-
<li><a href="#controller-abstraction">Controller Abstraction</a></li>
|
204
|
-
<li><a href="#arel-integration">Arel Integration</a></li>
|
205
|
-
<li><a href="#mail-extraction">Mail Extraction</a></li>
|
206
|
-
</ul>
|
207
|
-
</li>
|
208
|
-
<li><a href="#documentation">Documentation</a></li>
|
209
|
-
<li><a href="#internationalization">Internationalization</a></li>
|
210
|
-
<li><a href="#railties">Railties</a></li>
|
211
|
-
<li>
|
212
|
-
<a href="#action-pack">Action Pack</a>
|
213
|
-
|
214
|
-
<ul>
|
215
|
-
<li><a href="#abstract-controller">Abstract Controller</a></li>
|
216
|
-
<li><a href="#action-controller">Action Controller</a></li>
|
217
|
-
<li><a href="#action-dispatch">Action Dispatch</a></li>
|
218
|
-
<li><a href="#action-view">Action View</a></li>
|
219
|
-
</ul>
|
220
|
-
</li>
|
221
|
-
<li>
|
222
|
-
<a href="#active-model">Active Model</a>
|
223
|
-
|
224
|
-
<ul>
|
225
|
-
<li><a href="#orm-abstraction-and-action-pack-interface">ORM Abstraction and Action Pack Interface</a></li>
|
226
|
-
<li><a href="#validations">Validations</a></li>
|
227
|
-
</ul>
|
228
|
-
</li>
|
229
|
-
<li>
|
230
|
-
<a href="#active-record">Active Record</a>
|
231
|
-
|
232
|
-
<ul>
|
233
|
-
<li><a href="#query-interface">Query Interface</a></li>
|
234
|
-
<li><a href="#enhancements">Enhancements</a></li>
|
235
|
-
<li><a href="#patches-and-deprecations">Patches and Deprecations</a></li>
|
236
|
-
</ul>
|
237
|
-
</li>
|
238
|
-
<li><a href="#active-resource">Active Resource</a></li>
|
239
|
-
<li><a href="#active-support">Active Support</a></li>
|
240
|
-
<li><a href="#action-mailer">Action Mailer</a></li>
|
241
|
-
<li><a href="#credits">Credits</a></li>
|
242
|
-
</ol>
|
243
|
-
|
244
|
-
</div>
|
245
|
-
|
246
|
-
</div>
|
247
|
-
</div>
|
248
|
-
|
249
|
-
<div id="container">
|
250
|
-
<div class="wrapper">
|
251
|
-
<div id="mainCol">
|
252
|
-
<p>To install Rails 3:</p><div class="code_container">
|
253
|
-
<pre class="brush: plain; gutter: false; toolbar: false">
|
254
|
-
# Use sudo if your setup requires it
|
255
|
-
$ gem install rails
|
256
|
-
|
257
|
-
</pre>
|
258
|
-
</div>
|
259
|
-
<h3 id="upgrading-to-rails-3">1 Upgrading to Rails 3</h3><p>If you're upgrading an existing application, it's a great idea to have good test coverage before going in. You should also first upgrade to Rails 2.3.5 and make sure your application still runs as expected before attempting to update to Rails 3. Then take heed of the following changes:</p><h4 id="rails-3-requires-at-least-ruby-1.8.7">1.1 Rails 3 requires at least Ruby 1.8.7</h4><p>Rails 3.0 requires Ruby 1.8.7 or higher. Support for all of the previous Ruby versions has been dropped officially and you should upgrade as early as possible. Rails 3.0 is also compatible with Ruby 1.9.2.</p><div class="info"><p>Note that Ruby 1.8.7 p248 and p249 have marshaling bugs that crash Rails 3.0. Ruby Enterprise Edition have these fixed since release 1.8.7-2010.02 though. On the 1.9 front, Ruby 1.9.1 is not usable because it outright segfaults on Rails 3.0, so if you want to use Rails 3 with 1.9.x jump on 1.9.2 for smooth sailing.</p></div><h4 id="rails-application-object">1.2 Rails Application object</h4><p>As part of the groundwork for supporting running multiple Rails applications in the same process, Rails 3 introduces the concept of an Application object. An application object holds all the application specific configurations and is very similar in nature to <code>config/environment.rb</code> from the previous versions of Rails.</p><p>Each Rails application now must have a corresponding application object. The application object is defined in <code>config/application.rb</code>. If you're upgrading an existing application to Rails 3, you must add this file and move the appropriate configurations from <code>config/environment.rb</code> to <code>config/application.rb</code>.</p><h4 id="script/*-replaced-by-script/rails">1.3 script/* replaced by script/rails</h4><p>The new <code>script/rails</code> replaces all the scripts that used to be in the <code>script</code> directory. You do not run <code>script/rails</code> directly though, the <code>rails</code> command detects it is being invoked in the root of a Rails application and runs the script for you. Intended usage is:</p><div class="code_container">
|
260
|
-
<pre class="brush: plain; gutter: false; toolbar: false">
|
261
|
-
$ rails console # instead of script/console
|
262
|
-
$ rails g scaffold post title:string # instead of script/generate scaffold post title:string
|
263
|
-
|
264
|
-
</pre>
|
265
|
-
</div>
|
266
|
-
<p>Run <code>rails --help</code> for a list of all the options.</p><h4 id="dependencies-and-config.gem">1.4 Dependencies and config.gem</h4><p>The <code>config.gem</code> method is gone and has been replaced by using <code>bundler</code> and a <code>Gemfile</code>, see <a href="#vendoring-gems">Vendoring Gems</a> below.</p><h4 id="upgrade-process">1.5 Upgrade Process</h4><p>To help with the upgrade process, a plugin named <a href="http://github.com/rails/rails_upgrade">Rails Upgrade</a> has been created to automate part of it.</p><p>Simply install the plugin, then run <code>rake rails:upgrade:check</code> to check your app for pieces that need to be updated (with links to information on how to update them). It also offers a task to generate a <code>Gemfile</code> based on your current <code>config.gem</code> calls and a task to generate a new routes file from your current one. To get the plugin, simply run the following:</p><div class="code_container">
|
267
|
-
<pre class="brush: plain; gutter: false; toolbar: false">
|
268
|
-
$ ruby script/plugin install git://github.com/rails/rails_upgrade.git
|
269
|
-
|
270
|
-
</pre>
|
271
|
-
</div>
|
272
|
-
<p>You can see an example of how that works at <a href="http://omgbloglol.com/post/364624593/rails-upgrade-is-now-an-official-plugin">Rails Upgrade is now an Official Plugin</a></p><p>Aside from Rails Upgrade tool, if you need more help, there are people on IRC and <a href="http://groups.google.com/group/rubyonrails-talk">rubyonrails-talk</a> that are probably doing the same thing, possibly hitting the same issues. Be sure to blog your own experiences when upgrading so others can benefit from your knowledge!</p><h3 id="creating-a-rails-3.0-application">2 Creating a Rails 3.0 application</h3><div class="code_container">
|
273
|
-
<pre class="brush: plain; gutter: false; toolbar: false">
|
274
|
-
# You should have the 'rails' RubyGem installed
|
275
|
-
$ rails new myapp
|
276
|
-
$ cd myapp
|
277
|
-
|
278
|
-
</pre>
|
279
|
-
</div>
|
280
|
-
<h4 id="vendoring-gems">2.1 Vendoring Gems</h4><p>Rails now uses a <code>Gemfile</code> in the application root to determine the gems you require for your application to start. This <code>Gemfile</code> is processed by the <a href="http://github.com/carlhuda/bundler,">Bundler</a> which then installs all your dependencies. It can even install all the dependencies locally to your application so that it doesn't depend on the system gems.</p><p>More information: - <a href="http://gembundler.com">bundler homepage</a></p><h4 id="living-on-the-edge">2.2 Living on the Edge</h4><p><code>Bundler</code> and <code>Gemfile</code> makes freezing your Rails application easy as pie with the new dedicated <code>bundle</code> command, so <code>rake freeze</code> is no longer relevant and has been dropped.</p><p>If you want to bundle straight from the Git repository, you can pass the <code>--edge</code> flag:</p><div class="code_container">
|
281
|
-
<pre class="brush: plain; gutter: false; toolbar: false">
|
282
|
-
$ rails new myapp --edge
|
283
|
-
|
284
|
-
</pre>
|
285
|
-
</div>
|
286
|
-
<p>If you have a local checkout of the Rails repository and want to generate an application using that, you can pass the <code>--dev</code> flag:</p><div class="code_container">
|
287
|
-
<pre class="brush: plain; gutter: false; toolbar: false">
|
288
|
-
$ ruby /path/to/rails/bin/rails new myapp --dev
|
289
|
-
|
290
|
-
</pre>
|
291
|
-
</div>
|
292
|
-
<h3 id="rails-architectural-changes">3 Rails Architectural Changes</h3><p>There are six major changes in the architecture of Rails.</p><h4 id="railties-restrung">3.1 Railties Restrung</h4><p>Railties was updated to provide a consistent plugin API for the entire Rails framework as well as a total rewrite of generators and the Rails bindings, the result is that developers can now hook into any significant stage of the generators and application framework in a consistent, defined manner.</p><h4 id="all-rails-core-components-are-decoupled">3.2 All Rails core components are decoupled</h4><p>With the merge of Merb and Rails, one of the big jobs was to remove the tight coupling between Rails core components. This has now been achieved, and all Rails core components are now using the same API that you can use for developing plugins. This means any plugin you make, or any core component replacement (like DataMapper or Sequel) can access all the functionality that the Rails core components have access to and extend and enhance at will.</p><p>More information: - <a href="http://yehudakatz.com/2009/07/19/rails-3-the-great-decoupling/">The Great Decoupling</a></p><h4 id="active-model-abstraction">3.3 Active Model Abstraction</h4><p>Part of decoupling the core components was extracting all ties to Active Record from Action Pack. This has now been completed. All new ORM plugins now just need to implement Active Model interfaces to work seamlessly with Action Pack.</p><p>More information: - <a href="http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/">Make Any Ruby Object Feel Like ActiveRecord</a></p><h4 id="controller-abstraction">3.4 Controller Abstraction</h4><p>Another big part of decoupling the core components was creating a base superclass that is separated from the notions of HTTP in order to handle rendering of views etc. This creation of <code>AbstractController</code> allowed <code>ActionController</code> and <code>ActionMailer</code> to be greatly simplified with common code removed from all these libraries and put into Abstract Controller.</p><p>More Information: - <a href="http://yehudakatz.com/2009/06/11/rails-edge-architecture/">Rails Edge Architecture</a></p><h4 id="arel-integration">3.5 Arel Integration</h4><p><a href="http://github.com/brynary/arel">Arel</a> (or Active Relation) has been taken on as the underpinnings of Active Record and is now required for Rails. Arel provides an SQL abstraction that simplifies out Active Record and provides the underpinnings for the relation functionality in Active Record.</p><p>More information: - <a href="http://magicscalingsprinkles.wordpress.com/2010/01/28/why-i-wrote-arel/.">Why I wrote Arel</a></p><h4 id="mail-extraction">3.6 Mail Extraction</h4><p>Action Mailer ever since its beginnings has had monkey patches, pre parsers and even delivery and receiver agents, all in addition to having TMail vendored in the source tree. Version 3 changes that with all email message related functionality abstracted out to the <a href="http://github.com/mikel/mail">Mail</a> gem. This again reduces code duplication and helps create definable boundaries between Action Mailer and the email parser.</p><p>More information: - <a href="http://lindsaar.net/2010/1/26/new-actionmailer-api-in-rails-3">New Action Mailer API in Rails 3</a></p><h3 id="documentation">4 Documentation</h3><p>The documentation in the Rails tree is being updated with all the API changes, additionally, the <a href="http://edgeguides.rubyonrails.org/">Rails Edge Guides</a> are being updated one by one to reflect the changes in Rails 3.0. The guides at <a href="http://guides.rubyonrails.org/">guides.rubyonrails.org</a> however will continue to contain only the stable version of Rails (at this point, version 2.3.5, until 3.0 is released).</p><p>More Information: - <a href="http://weblog.rubyonrails.org/2009/1/15/rails-documentation-projects.">Rails Documentation Projects</a></p><h3 id="internationalization">5 Internationalization</h3><p>A large amount of work has been done with I18n support in Rails 3, including the latest <a href="http://github.com/svenfuchs/i18n">I18n</a> gem supplying many speed improvements.</p>
|
293
|
-
<ul>
|
294
|
-
<li>I18n for any object - I18n behavior can be added to any object by including <code>ActiveModel::Translation</code> and <code>ActiveModel::Validations</code>. There is also an <code>errors.messages</code> fallback for translations.</li>
|
295
|
-
<li>Attributes can have default translations.</li>
|
296
|
-
<li>Form Submit Tags automatically pull the correct status (Create or Update) depending on the object status, and so pull the correct translation.</li>
|
297
|
-
<li>Labels with I18n also now work by just passing the attribute name.</li>
|
298
|
-
</ul>
|
299
|
-
<p>More Information: - <a href="http://blog.plataformatec.com.br/2010/02/rails-3-i18n-changes/">Rails 3 I18n changes</a></p><h3 id="railties">6 Railties</h3><p>With the decoupling of the main Rails frameworks, Railties got a huge overhaul so as to make linking up frameworks, engines or plugins as painless and extensible as possible:</p>
|
300
|
-
<ul>
|
301
|
-
<li>Each application now has its own name space, application is started with <code>YourAppName.boot</code> for example, makes interacting with other applications a lot easier.</li>
|
302
|
-
<li>Anything under <code>Rails.root/app</code> is now added to the load path, so you can make <code>app/observers/user_observer.rb</code> and Rails will load it without any modifications.</li>
|
303
|
-
<li>
|
304
|
-
<p>Rails 3.0 now provides a <code>Rails.config</code> object, which provides a central repository of all sorts of Rails wide configuration options.</p>
|
305
|
-
<p>Application generation has received extra flags allowing you to skip the installation of test-unit, Active Record, Prototype and Git. Also a new <code>--dev</code> flag has been added which sets the application up with the <code>Gemfile</code> pointing to your Rails checkout (which is determined by the path to the <code>rails</code> binary). See <code>rails --help</code> for more info.</p>
|
306
|
-
</li>
|
307
|
-
</ul>
|
308
|
-
<p>Railties generators got a huge amount of attention in Rails 3.0, basically:</p>
|
309
|
-
<ul>
|
310
|
-
<li>Generators were completely rewritten and are backwards incompatible.</li>
|
311
|
-
<li>Rails templates API and generators API were merged (they are the same as the former).</li>
|
312
|
-
<li>Generators are no longer loaded from special paths anymore, they are just found in the Ruby load path, so calling <code>rails generate foo</code> will look for <code>generators/foo_generator</code>.</li>
|
313
|
-
<li>New generators provide hooks, so any template engine, ORM, test framework can easily hook in.</li>
|
314
|
-
<li>New generators allow you to override the templates by placing a copy at <code>Rails.root/lib/templates</code>.</li>
|
315
|
-
<li>
|
316
|
-
<code>Rails::Generators::TestCase</code> is also supplied so you can create your own generators and test them.</li>
|
317
|
-
</ul>
|
318
|
-
<p>Also, the views generated by Railties generators had some overhaul:</p>
|
319
|
-
<ul>
|
320
|
-
<li>Views now use <code>div</code> tags instead of <code>p</code> tags.</li>
|
321
|
-
<li>Scaffolds generated now make use of <code>_form</code> partials, instead of duplicated code in the edit and new views.</li>
|
322
|
-
<li>Scaffold forms now use <code>f.submit</code> which returns "Create ModelName" or "Update ModelName" depending on the state of the object passed in.</li>
|
323
|
-
</ul>
|
324
|
-
<p>Finally a couple of enhancements were added to the rake tasks:</p>
|
325
|
-
<ul>
|
326
|
-
<li>
|
327
|
-
<code>rake db:forward</code> was added, allowing you to roll forward your migrations individually or in groups.</li>
|
328
|
-
<li>
|
329
|
-
<code>rake routes CONTROLLER=x</code> was added allowing you to just view the routes for one controller.</li>
|
330
|
-
</ul>
|
331
|
-
<p>Railties now deprecates:</p>
|
332
|
-
<ul>
|
333
|
-
<li>
|
334
|
-
<code>RAILS_ROOT</code> in favor of <code>Rails.root</code>,</li>
|
335
|
-
<li>
|
336
|
-
<code>RAILS_ENV</code> in favor of <code>Rails.env</code>, and</li>
|
337
|
-
<li>
|
338
|
-
<code>RAILS_DEFAULT_LOGGER</code> in favor of <code>Rails.logger</code>.</li>
|
339
|
-
</ul>
|
340
|
-
<p><code>PLUGIN/rails/tasks</code>, and <code>PLUGIN/tasks</code> are no longer loaded all tasks now must be in <code>PLUGIN/lib/tasks</code>.</p><p>More information:</p>
|
341
|
-
<ul>
|
342
|
-
<li><a href="http://blog.plataformatec.com.br/2010/01/discovering-rails-3-generators">Discovering Rails 3 generators</a></li>
|
343
|
-
<li><a href="http://caffeinedd.com/guides/331-making-generators-for-rails-3-with-thor">Making Generators for Rails 3 with Thor</a></li>
|
344
|
-
<li><a href="http://litanyagainstfear.com/blog/2010/02/03/the-rails-module/">The Rails Module (in Rails 3)</a></li>
|
345
|
-
</ul>
|
346
|
-
<h3 id="action-pack">7 Action Pack</h3><p>There have been significant internal and external changes in Action Pack.</p><h4 id="abstract-controller">7.1 Abstract Controller</h4><p>Abstract Controller pulls out the generic parts of Action Controller into a reusable module that any library can use to render templates, render partials, helpers, translations, logging, any part of the request response cycle. This abstraction allowed <code>ActionMailer::Base</code> to now just inherit from <code>AbstractController</code> and just wrap the Rails DSL onto the Mail gem.</p><p>It also provided an opportunity to clean up Action Controller, abstracting out what could to simplify the code.</p><p>Note however that Abstract Controller is not a user facing API, you will not run into it in your day to day use of Rails.</p><p>More Information: - <a href="http://yehudakatz.com/2009/06/11/rails-edge-architecture/">Rails Edge Architecture</a></p><h4 id="action-controller">7.2 Action Controller</h4>
|
347
|
-
<ul>
|
348
|
-
<li>
|
349
|
-
<code>application_controller.rb</code> now has <code>protect_from_forgery</code> on by default.</li>
|
350
|
-
<li>The <code>cookie_verifier_secret</code> has been deprecated and now instead it is assigned through <code>Rails.application.config.cookie_secret</code> and moved into its own file: <code>config/initializers/cookie_verification_secret.rb</code>.</li>
|
351
|
-
<li>The <code>session_store</code> was configured in <code>ActionController::Base.session</code>, and that is now moved to <code>Rails.application.config.session_store</code>. Defaults are set up in <code>config/initializers/session_store.rb</code>.</li>
|
352
|
-
<li>
|
353
|
-
<code>cookies.secure</code> allowing you to set encrypted values in cookies with <code>cookie.secure[:key] => value</code>.</li>
|
354
|
-
<li>
|
355
|
-
<code>cookies.permanent</code> allowing you to set permanent values in the cookie hash <code>cookie.permanent[:key] => value</code> that raise exceptions on signed values if verification failures.</li>
|
356
|
-
<li>You can now pass <code>:notice => 'This is a flash message'</code> or <code>:alert => 'Something went wrong'</code> to the <code>format</code> call inside a <code>respond_to</code> block. The <code>flash[]</code> hash still works as previously.</li>
|
357
|
-
<li>
|
358
|
-
<code>respond_with</code> method has now been added to your controllers simplifying the venerable <code>format</code> blocks.</li>
|
359
|
-
<li>
|
360
|
-
<code>ActionController::Responder</code> added allowing you flexibility in how your responses get generated.</li>
|
361
|
-
</ul>
|
362
|
-
<p>Deprecations:</p>
|
363
|
-
<ul>
|
364
|
-
<li>
|
365
|
-
<code>filter_parameter_logging</code> is deprecated in favor of <code>config.filter_parameters << :password</code>.</li>
|
366
|
-
</ul>
|
367
|
-
<p>More Information:</p>
|
368
|
-
<ul>
|
369
|
-
<li><a href="http://www.engineyard.com/blog/2010/render-options-in-rails-3/">Render Options in Rails 3</a></li>
|
370
|
-
<li><a href="http://weblog.rubyonrails.org/2009/8/31/three-reasons-love-responder">Three reasons to love ActionController::Responder</a></li>
|
371
|
-
</ul>
|
372
|
-
<h4 id="action-dispatch">7.3 Action Dispatch</h4><p>Action Dispatch is new in Rails 3.0 and provides a new, cleaner implementation for routing.</p>
|
373
|
-
<ul>
|
374
|
-
<li>Big clean up and re-write of the router, the Rails router is now <code>rack_mount</code> with a Rails DSL on top, it is a stand alone piece of software.</li>
|
375
|
-
<li>
|
376
|
-
<p>Routes defined by each application are now name spaced within your Application module, that is:</p>
|
377
|
-
<div class="code_container">
|
378
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
379
|
-
# Instead of:
|
380
|
-
|
381
|
-
ActionController::Routing::Routes.draw do |map|
|
382
|
-
map.resources :posts
|
383
|
-
end
|
384
|
-
|
385
|
-
# You do:
|
386
|
-
|
387
|
-
AppName::Application.routes do
|
388
|
-
resources :posts
|
389
|
-
end
|
390
|
-
|
391
|
-
</pre>
|
392
|
-
</div>
|
393
|
-
</li>
|
394
|
-
<li><p>Added <code>match</code> method to the router, you can also pass any Rack application to the matched route.</p></li>
|
395
|
-
<li><p>Added <code>constraints</code> method to the router, allowing you to guard routers with defined constraints.</p></li>
|
396
|
-
<li>
|
397
|
-
<p>Added <code>scope</code> method to the router, allowing you to namespace routes for different languages or different actions, for example:</p>
|
398
|
-
<div class="code_container">
|
399
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
400
|
-
scope 'es' do
|
401
|
-
resources :projects, :path_names => { :edit => 'cambiar' }, :path => 'proyecto'
|
402
|
-
end
|
403
|
-
|
404
|
-
# Gives you the edit action with /es/proyecto/1/cambiar
|
405
|
-
|
406
|
-
</pre>
|
407
|
-
</div>
|
408
|
-
</li>
|
409
|
-
<li><p>Added <code>root</code> method to the router as a short cut for <code>match '/', :to => path</code>.</p></li>
|
410
|
-
<li><p>You can pass optional segments into the match, for example <code>match "/:controller(/:action(/:id))(.:format)"</code>, each parenthesized segment is optional.</p></li>
|
411
|
-
<li><p>Routes can be expressed via blocks, for example you can call <code>controller :home { match '/:action' }</code>.</p></li>
|
412
|
-
</ul>
|
413
|
-
<div class="note"><p>The old style <code>map</code> commands still work as before with a backwards compatibility layer, however this will be removed in the 3.1 release.</p></div><p>Deprecations</p>
|
414
|
-
<ul>
|
415
|
-
<li>The catch all route for non-REST applications (<code>/:controller/:action/:id</code>) is now commented out.</li>
|
416
|
-
<li>Routes <code>:path_prefix</code> no longer exists and <code>:name_prefix</code> now automatically adds "_" at the end of the given value.</li>
|
417
|
-
</ul>
|
418
|
-
<p>More Information:
|
419
|
-
* <a href="http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up/">The Rails 3 Router: Rack it Up</a>
|
420
|
-
* <a href="http://rizwanreza.com/2009/12/20/revamped-routes-in-rails-3">Revamped Routes in Rails 3</a>
|
421
|
-
* <a href="http://yehudakatz.com/2009/12/20/generic-actions-in-rails-3/">Generic Actions in Rails 3</a></p><h4 id="action-view">7.4 Action View</h4><h5 id="unobtrusive-javascript">7.4.1 Unobtrusive JavaScript</h5><p>Major re-write was done in the Action View helpers, implementing Unobtrusive JavaScript (UJS) hooks and removing the old inline AJAX commands. This enables Rails to use any compliant UJS driver to implement the UJS hooks in the helpers.</p><p>What this means is that all previous <code>remote_<method></code> helpers have been removed from Rails core and put into the <a href="http://github.com/rails/prototype_legacy_helper">Prototype Legacy Helper</a>. To get UJS hooks into your HTML, you now pass <code>:remote => true</code> instead. For example:</p><div class="code_container">
|
422
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
423
|
-
form_for @post, :remote => true
|
424
|
-
|
425
|
-
</pre>
|
426
|
-
</div>
|
427
|
-
<p>Produces:</p><div class="code_container">
|
428
|
-
<pre class="brush: xml; gutter: false; toolbar: false">
|
429
|
-
<form action="http://host.com" id="create-post" method="post" data-remote="true">
|
430
|
-
|
431
|
-
</pre>
|
432
|
-
</div>
|
433
|
-
<h5 id="helpers-with-blocks">7.4.2 Helpers with Blocks</h5><p>Helpers like <code>form_for</code> or <code>div_for</code> that insert content from a block use <code><%=</code> now:</p><div class="code_container">
|
434
|
-
<pre class="brush: plain; gutter: false; toolbar: false">
|
435
|
-
<%= form_for @post do |f| %>
|
436
|
-
...
|
437
|
-
<% end %>
|
438
|
-
|
439
|
-
</pre>
|
440
|
-
</div>
|
441
|
-
<p>Your own helpers of that kind are expected to return a string, rather than appending to the output buffer by hand.</p><p>Helpers that do something else, like <code>cache</code> or <code>content_for</code>, are not affected by this change, they need <code>&lt;%</code> as before.</p><h5 id="other-changes">7.4.3 Other Changes</h5>
|
442
|
-
<ul>
|
443
|
-
<li>You no longer need to call <code>h(string)</code> to escape HTML output, it is on by default in all view templates. If you want the unescaped string, call <code>raw(string)</code>.</li>
|
444
|
-
<li>Helpers now output HTML 5 by default.</li>
|
445
|
-
<li>Form label helper now pulls values from I18n with a single value, so <code>f.label :name</code> will pull the <code>:name</code> translation.</li>
|
446
|
-
<li>I18n select label on should now be :en.helpers.select instead of :en.support.select.</li>
|
447
|
-
<li>You no longer need to place a minus sign at the end of a Ruby interpolation inside an ERB template to remove the trailing carriage return in the HTML output.</li>
|
448
|
-
<li>Added <code>grouped_collection_select</code> helper to Action View.</li>
|
449
|
-
<li>
|
450
|
-
<code>content_for?</code> has been added allowing you to check for the existence of content in a view before rendering.</li>
|
451
|
-
<li>passing <code>:value => nil</code> to form helpers will set the field's <code>value</code> attribute to nil as opposed to using the default value</li>
|
452
|
-
<li>passing <code>:id => nil</code> to form helpers will cause those fields to be rendered with no <code>id</code> attribute</li>
|
453
|
-
<li>passing <code>:alt => nil</code> to <code>image_tag</code> will cause the <code>img</code> tag to render with no <code>alt</code> attribute</li>
|
454
|
-
</ul>
|
455
|
-
<h3 id="active-model">8 Active Model</h3><p>Active Model is new in Rails 3.0. It provides an abstraction layer for any ORM libraries to use to interact with Rails by implementing an Active Model interface.</p><h4 id="orm-abstraction-and-action-pack-interface">8.1 ORM Abstraction and Action Pack Interface</h4><p>Part of decoupling the core components was extracting all ties to Active Record from Action Pack. This has now been completed. All new ORM plugins now just need to implement Active Model interfaces to work seamlessly with Action Pack.</p><p>More Information: - <a href="http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/">Make Any Ruby Object Feel Like ActiveRecord</a></p><h4 id="validations">8.2 Validations</h4><p>Validations have been moved from Active Record into Active Model, providing an interface to validations that works across ORM libraries in Rails 3.</p>
|
456
|
-
<ul>
|
457
|
-
<li>There is now a <code>validates :attribute, options_hash</code> shortcut method that allows you to pass options for all the validates class methods, you can pass more than one option to a validate method.</li>
|
458
|
-
<li>The <code>validates</code> method has the following options:
|
459
|
-
|
460
|
-
<ul>
|
461
|
-
<li>
|
462
|
-
<code>:acceptance => Boolean</code>.</li>
|
463
|
-
<li>
|
464
|
-
<code>:confirmation => Boolean</code>.</li>
|
465
|
-
<li>
|
466
|
-
<code>:exclusion => { :in => Enumerable }</code>.</li>
|
467
|
-
<li>
|
468
|
-
<code>:inclusion => { :in => Enumerable }</code>.</li>
|
469
|
-
<li>
|
470
|
-
<code>:format => { :with => Regexp, :on => :create }</code>.</li>
|
471
|
-
<li>
|
472
|
-
<code>:length => { :maximum => Fixnum }</code>.</li>
|
473
|
-
<li>
|
474
|
-
<code>:numericality => Boolean</code>.</li>
|
475
|
-
<li>
|
476
|
-
<code>:presence => Boolean</code>.</li>
|
477
|
-
<li>
|
478
|
-
<code>:uniqueness => Boolean</code>.</li>
|
479
|
-
</ul>
|
480
|
-
</li>
|
481
|
-
</ul>
|
482
|
-
<div class="note"><p>All the Rails version 2.3 style validation methods are still supported in Rails 3.0, the new validates method is designed as an additional aid in your model validations, not a replacement for the existing API.</p></div><p>You can also pass in a validator object, which you can then reuse between objects that use Active Model:</p><div class="code_container">
|
483
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
484
|
-
class TitleValidator < ActiveModel::EachValidator
|
485
|
-
Titles = ['Mr.', 'Mrs.', 'Dr.']
|
486
|
-
def validate_each(record, attribute, value)
|
487
|
-
unless Titles.include?(value)
|
488
|
-
record.errors[attribute] << 'must be a valid title'
|
489
|
-
end
|
490
|
-
end
|
491
|
-
end
|
492
|
-
|
493
|
-
</pre>
|
494
|
-
</div>
|
495
|
-
<div class="code_container">
|
496
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
497
|
-
class Person
|
498
|
-
include ActiveModel::Validations
|
499
|
-
attr_accessor :title
|
500
|
-
validates :title, :presence => true, :title => true
|
501
|
-
end
|
502
|
-
|
503
|
-
# Or for Active Record
|
504
|
-
|
505
|
-
class Person < ActiveRecord::Base
|
506
|
-
validates :title, :presence => true, :title => true
|
507
|
-
end
|
508
|
-
|
509
|
-
</pre>
|
510
|
-
</div>
|
511
|
-
<p>There's also support for introspection:</p><div class="code_container">
|
512
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
513
|
-
User.validators
|
514
|
-
User.validators_on(:login)
|
515
|
-
|
516
|
-
</pre>
|
517
|
-
</div>
|
518
|
-
<p>More Information:</p>
|
519
|
-
<ul>
|
520
|
-
<li><a href="http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/">Sexy Validation in Rails 3</a></li>
|
521
|
-
<li><a href="http://lindsaar.net/2010/1/31/validates_rails_3_awesome_is_true">Rails 3 Validations Explained</a></li>
|
522
|
-
</ul>
|
523
|
-
<h3 id="active-record">9 Active Record</h3><p>Active Record received a lot of attention in Rails 3.0, including abstraction into Active Model, a full update to the Query interface using Arel, validation updates and many enhancements and fixes. All of the Rails 2.x API will be usable through a compatibility layer that will be supported until version 3.1.</p><h4 id="query-interface">9.1 Query Interface</h4><p>Active Record, through the use of Arel, now returns relations on its core methods. The existing API in Rails 2.3.x is still supported and will not be deprecated until Rails 3.1 and not removed until Rails 3.2, however, the new API provides the following new methods that all return relations allowing them to be chained together:</p>
|
524
|
-
<ul>
|
525
|
-
<li>
|
526
|
-
<code>where</code> - provides conditions on the relation, what gets returned.</li>
|
527
|
-
<li>
|
528
|
-
<code>select</code> - choose what attributes of the models you wish to have returned from the database.</li>
|
529
|
-
<li>
|
530
|
-
<code>group</code> - groups the relation on the attribute supplied.</li>
|
531
|
-
<li>
|
532
|
-
<code>having</code> - provides an expression limiting group relations (GROUP BY constraint).</li>
|
533
|
-
<li>
|
534
|
-
<code>joins</code> - joins the relation to another table.</li>
|
535
|
-
<li>
|
536
|
-
<code>clause</code> - provides an expression limiting join relations (JOIN constraint).</li>
|
537
|
-
<li>
|
538
|
-
<code>includes</code> - includes other relations pre-loaded.</li>
|
539
|
-
<li>
|
540
|
-
<code>order</code> - orders the relation based on the expression supplied.</li>
|
541
|
-
<li>
|
542
|
-
<code>limit</code> - limits the relation to the number of records specified.</li>
|
543
|
-
<li>
|
544
|
-
<code>lock</code> - locks the records returned from the table.</li>
|
545
|
-
<li>
|
546
|
-
<code>readonly</code> - returns an read only copy of the data.</li>
|
547
|
-
<li>
|
548
|
-
<code>from</code> - provides a way to select relationships from more than one table.</li>
|
549
|
-
<li>
|
550
|
-
<code>scope</code> - (previously <code>named_scope</code>) return relations and can be chained together with the other relation methods.</li>
|
551
|
-
<li>
|
552
|
-
<code>with_scope</code> - and <code>with_exclusive_scope</code> now also return relations and so can be chained.</li>
|
553
|
-
<li>
|
554
|
-
<code>default_scope</code> - also works with relations.</li>
|
555
|
-
</ul>
|
556
|
-
<p>More Information:</p>
|
557
|
-
<ul>
|
558
|
-
<li><a href="http://m.onkey.org/2010/1/22/active-record-query-interface">Active Record Query Interface</a></li>
|
559
|
-
<li><a href="http://hasmanyquestions.wordpress.com/2010/01/17/let-your-sql-growl-in-rails-3/">Let your SQL Growl in Rails 3</a></li>
|
560
|
-
</ul>
|
561
|
-
<h4 id="enhancements">9.2 Enhancements</h4>
|
562
|
-
<ul>
|
563
|
-
<li>Added <code>:destroyed?</code> to Active Record objects.</li>
|
564
|
-
<li>Added <code>:inverse_of</code> to Active Record associations allowing you to pull the instance of an already loaded association without hitting the database.</li>
|
565
|
-
</ul>
|
566
|
-
<h4 id="patches-and-deprecations">9.3 Patches and Deprecations</h4><p>Additionally, many fixes in the Active Record branch:</p>
|
567
|
-
<ul>
|
568
|
-
<li>SQLite 2 support has been dropped in favor of SQLite 3.</li>
|
569
|
-
<li>MySQL support for column order.</li>
|
570
|
-
<li>PostgreSQL adapter has had its <code>TIME ZONE</code> support fixed so it no longer inserts incorrect values.</li>
|
571
|
-
<li>Support multiple schemas in table names for PostgreSQL.</li>
|
572
|
-
<li>PostgreSQL support for the XML data type column.</li>
|
573
|
-
<li>
|
574
|
-
<code>table_name</code> is now cached.</li>
|
575
|
-
<li>A large amount of work done on the Oracle adapter as well with many bug fixes.</li>
|
576
|
-
</ul>
|
577
|
-
<p>As well as the following deprecations:</p>
|
578
|
-
<ul>
|
579
|
-
<li>
|
580
|
-
<code>named_scope</code> in an Active Record class is deprecated and has been renamed to just <code>scope</code>.</li>
|
581
|
-
<li>In <code>scope</code> methods, you should move to using the relation methods, instead of a <code>:conditions => {}</code> finder method, for example <code>scope :since, lambda {|time| where("created_at > ?", time) }</code>.</li>
|
582
|
-
<li>
|
583
|
-
<code>save(false)</code> is deprecated, in favor of <code>save(:validate => false)</code>.</li>
|
584
|
-
<li>I18n error messages for Active Record should be changed from :en.activerecord.errors.template to <code>:en.errors.template</code>.</li>
|
585
|
-
<li>
|
586
|
-
<code>model.errors.on</code> is deprecated in favor of <code>model.errors[]</code>
|
587
|
-
</li>
|
588
|
-
<li>validates_presence_of => validates... :presence => true</li>
|
589
|
-
<li>
|
590
|
-
<code>ActiveRecord::Base.colorize_logging</code> and <code>config.active_record.colorize_logging</code> are deprecated in favor of <code>Rails::LogSubscriber.colorize_logging</code> or <code>config.colorize_logging</code>
|
591
|
-
</li>
|
592
|
-
</ul>
|
593
|
-
<div class="note"><p>While an implementation of State Machine has been in Active Record edge for some months now, it has been removed from the Rails 3.0 release.</p></div><h3 id="active-resource">10 Active Resource</h3><p>Active Resource was also extracted out to Active Model allowing you to use Active Resource objects with Action Pack seamlessly.</p>
|
594
|
-
<ul>
|
595
|
-
<li>Added validations through Active Model.</li>
|
596
|
-
<li>Added observing hooks.</li>
|
597
|
-
<li>HTTP proxy support.</li>
|
598
|
-
<li>Added support for digest authentication.</li>
|
599
|
-
<li>Moved model naming into Active Model.</li>
|
600
|
-
<li>Changed Active Resource attributes to a Hash with indifferent access.</li>
|
601
|
-
<li>Added <code>first</code>, <code>last</code> and <code>all</code> aliases for equivalent find scopes.</li>
|
602
|
-
<li>
|
603
|
-
<code>find_every</code> now does not return a <code>ResourceNotFound</code> error if nothing returned.</li>
|
604
|
-
<li>Added <code>save!</code> which raises <code>ResourceInvalid</code> unless the object is <code>valid?</code>.</li>
|
605
|
-
<li>
|
606
|
-
<code>update_attribute</code> and <code>update_attributes</code> added to Active Resource models.</li>
|
607
|
-
<li>Added <code>exists?</code>.</li>
|
608
|
-
<li>Renamed <code>SchemaDefinition</code> to <code>Schema</code> and <code>define_schema</code> to <code>schema</code>.</li>
|
609
|
-
<li>Use the <code>format</code> of Active Resources rather than the <code>content-type</code> of remote errors to load errors.</li>
|
610
|
-
<li>Use <code>instance_eval</code> for schema block.</li>
|
611
|
-
<li>Fix <code>ActiveResource::ConnectionError#to_s</code> when <code>@response</code> does not respond to #code or #message, handles Ruby 1.9 compatibility.</li>
|
612
|
-
<li>Add support for errors in JSON format.</li>
|
613
|
-
<li>Ensure <code>load</code> works with numeric arrays.</li>
|
614
|
-
<li>Recognizes a 410 response from remote resource as the resource has been deleted.</li>
|
615
|
-
<li>Add ability to set SSL options on Active Resource connections.</li>
|
616
|
-
<li>Setting connection timeout also affects <code>Net::HTTP</code> <code>open_timeout</code>.</li>
|
617
|
-
</ul>
|
618
|
-
<p>Deprecations:</p>
|
619
|
-
<ul>
|
620
|
-
<li>
|
621
|
-
<code>save(false)</code> is deprecated, in favor of <code>save(:validate => false)</code>.</li>
|
622
|
-
<li>Ruby 1.9.2: <code>URI.parse</code> and <code>.decode</code> are deprecated and are no longer used in the library.</li>
|
623
|
-
</ul>
|
624
|
-
<h3 id="active-support">11 Active Support</h3><p>A large effort was made in Active Support to make it cherry pickable, that is, you no longer have to require the entire Active Support library to get pieces of it. This allows the various core components of Rails to run slimmer.</p><p>These are the main changes in Active Support:</p>
|
625
|
-
<ul>
|
626
|
-
<li>Large clean up of the library removing unused methods throughout.</li>
|
627
|
-
<li>Active Support no longer provides vendored versions of TZInfo, Memcache Client and Builder. These are all included as dependencies and installed via the <code>bundle install</code> command.</li>
|
628
|
-
<li>Safe buffers are implemented in <code>ActiveSupport::SafeBuffer</code>.</li>
|
629
|
-
<li>Added <code>Array.uniq_by</code> and <code>Array.uniq_by!</code>.</li>
|
630
|
-
<li>Removed <code>Array#rand</code> and backported <code>Array#sample</code> from Ruby 1.9.</li>
|
631
|
-
<li>Fixed bug on <code>TimeZone.seconds_to_utc_offset</code> returning wrong value.</li>
|
632
|
-
<li>Added <code>ActiveSupport::Notifications</code> middleware.</li>
|
633
|
-
<li>
|
634
|
-
<code>ActiveSupport.use_standard_json_time_format</code> now defaults to true.</li>
|
635
|
-
<li>
|
636
|
-
<code>ActiveSupport.escape_html_entities_in_json</code> now defaults to false.</li>
|
637
|
-
<li>
|
638
|
-
<code>Integer#multiple_of?</code> accepts zero as an argument, returns false unless the receiver is zero.</li>
|
639
|
-
<li>
|
640
|
-
<code>string.chars</code> has been renamed to <code>string.mb_chars</code>.</li>
|
641
|
-
<li>
|
642
|
-
<code>ActiveSupport::OrderedHash</code> now can de-serialize through YAML.</li>
|
643
|
-
<li>Added SAX-based parser for XmlMini, using LibXML and Nokogiri.</li>
|
644
|
-
<li>Added <code>Object#presence</code> that returns the object if it's <code>#present?</code> otherwise returns <code>nil</code>.</li>
|
645
|
-
<li>Added <code>String#exclude?</code> core extension that returns the inverse of <code>#include?</code>.</li>
|
646
|
-
<li>Added <code>to_i</code> to <code>DateTime</code> in <code>ActiveSupport</code> so <code>to_yaml</code> works correctly on models with <code>DateTime</code> attributes.</li>
|
647
|
-
<li>Added <code>Enumerable#exclude?</code> to bring parity to <code>Enumerable#include?</code> and avoid if <code>!x.include?</code>.</li>
|
648
|
-
<li>Switch to on-by-default XSS escaping for rails.</li>
|
649
|
-
<li>Support deep-merging in <code>ActiveSupport::HashWithIndifferentAccess</code>.</li>
|
650
|
-
<li>
|
651
|
-
<code>Enumerable#sum</code> now works will all enumerables, even if they don't respond to <code>:size</code>.</li>
|
652
|
-
<li>
|
653
|
-
<code>inspect</code> on a zero length duration returns '0 seconds' instead of empty string.</li>
|
654
|
-
<li>Add <code>element</code> and <code>collection</code> to <code>ModelName</code>.</li>
|
655
|
-
<li>
|
656
|
-
<code>String#to_time</code> and <code>String#to_datetime</code> handle fractional seconds.</li>
|
657
|
-
<li>Added support to new callbacks for around filter object that respond to <code>:before</code> and <code>:after</code> used in before and after callbacks.</li>
|
658
|
-
<li>The <code>ActiveSupport::OrderedHash#to_a</code> method returns an ordered set of arrays. Matches Ruby 1.9's <code>Hash#to_a</code>.</li>
|
659
|
-
<li>
|
660
|
-
<code>MissingSourceFile</code> exists as a constant but it is now just equals to <code>LoadError</code>.</li>
|
661
|
-
<li>Added <code>Class#class_attribute</code>, to be able to declare a class-level attribute whose value is inheritable and overwritable by subclasses.</li>
|
662
|
-
<li>Finally removed <code>DeprecatedCallbacks</code> in <code>ActiveRecord::Associations</code>.</li>
|
663
|
-
<li>
|
664
|
-
<code>Object#metaclass</code> is now <code>Kernel#singleton_class</code> to match Ruby.</li>
|
665
|
-
</ul>
|
666
|
-
<p>The following methods have been removed because they are now available in Ruby 1.8.7 and 1.9.</p>
|
667
|
-
<ul>
|
668
|
-
<li>
|
669
|
-
<code>Integer#even?</code> and <code>Integer#odd?</code>
|
670
|
-
</li>
|
671
|
-
<li><code>String#each_char</code></li>
|
672
|
-
<li>
|
673
|
-
<code>String#start_with?</code> and <code>String#end_with?</code> (3rd person aliases still kept)</li>
|
674
|
-
<li><code>String#bytesize</code></li>
|
675
|
-
<li><code>Object#tap</code></li>
|
676
|
-
<li><code>Symbol#to_proc</code></li>
|
677
|
-
<li><code>Object#instance_variable_defined?</code></li>
|
678
|
-
<li><code>Enumerable#none?</code></li>
|
679
|
-
</ul>
|
680
|
-
<p>The security patch for REXML remains in Active Support because early patch-levels of Ruby 1.8.7 still need it. Active Support knows whether it has to apply it or not.</p><p>The following methods have been removed because they are no longer used in the framework:</p>
|
681
|
-
<ul>
|
682
|
-
<li><code>Kernel#daemonize</code></li>
|
683
|
-
<li>
|
684
|
-
<code>Object#remove_subclasses_of</code> <code>Object#extend_with_included_modules_from</code>, <code>Object#extended_by</code>
|
685
|
-
</li>
|
686
|
-
<li><code>Class#remove_class</code></li>
|
687
|
-
<li>
|
688
|
-
<code>Regexp#number_of_captures</code>, <code>Regexp.unoptionalize</code>, <code>Regexp.optionalize</code>, <code>Regexp#number_of_captures</code>
|
689
|
-
</li>
|
690
|
-
</ul>
|
691
|
-
<h3 id="action-mailer">12 Action Mailer</h3><p>Action Mailer has been given a new API with TMail being replaced out with the new <a href="http://github.com/mikel/mail">Mail</a> as the email library. Action Mailer itself has been given an almost complete re-write with pretty much every line of code touched. The result is that Action Mailer now simply inherits from Abstract Controller and wraps the Mail gem in a Rails DSL. This reduces the amount of code and duplication of other libraries in Action Mailer considerably.</p>
|
692
|
-
<ul>
|
693
|
-
<li>All mailers are now in <code>app/mailers</code> by default.</li>
|
694
|
-
<li>Can now send email using new API with three methods: <code>attachments</code>, <code>headers</code> and <code>mail</code>.</li>
|
695
|
-
<li>Action Mailer now has native support for inline attachments using the <code>attachments.inline</code> method.</li>
|
696
|
-
<li>Action Mailer emailing methods now return <code>Mail::Message</code> objects, which can then be sent the <code>deliver</code> message to send itself.</li>
|
697
|
-
<li>All delivery methods are now abstracted out to the Mail gem.</li>
|
698
|
-
<li>The mail delivery method can accept a hash of all valid mail header fields with their value pair.</li>
|
699
|
-
<li>The <code>mail</code> delivery method acts in a similar way to Action Controller's <code>respond_to</code>, and you can explicitly or implicitly render templates. Action Mailer will turn the email into a multipart email as needed.</li>
|
700
|
-
<li>You can pass a proc to the <code>format.mime_type</code> calls within the mail block and explicitly render specific types of text, or add layouts or different templates. The <code>render</code> call inside the proc is from Abstract Controller and supports the same options.</li>
|
701
|
-
<li>What were mailer unit tests have been moved to functional tests.</li>
|
702
|
-
<li>Action Mailer now delegates all auto encoding of header fields and bodies to Mail Gem</li>
|
703
|
-
<li>Action Mailer will auto encode email bodies and headers for you</li>
|
704
|
-
</ul>
|
705
|
-
<p>Deprecations:</p>
|
706
|
-
<ul>
|
707
|
-
<li>
|
708
|
-
<code>:charset</code>, <code>:content_type</code>, <code>:mime_version</code>, <code>:implicit_parts_order</code> are all deprecated in favor of <code>ActionMailer.default :key => value</code> style declarations.</li>
|
709
|
-
<li>Mailer dynamic <code>create_method_name</code> and <code>deliver_method_name</code> are deprecated, just call <code>method_name</code> which now returns a <code>Mail::Message</code> object.</li>
|
710
|
-
<li>
|
711
|
-
<code>ActionMailer.deliver(message)</code> is deprecated, just call <code>message.deliver</code>.</li>
|
712
|
-
<li>
|
713
|
-
<code>template_root</code> is deprecated, pass options to a render call inside a proc from the <code>format.mime_type</code> method inside the <code>mail</code> generation block</li>
|
714
|
-
<li>The <code>body</code> method to define instance variables is deprecated (<code>body {:ivar => value}</code>), just declare instance variables in the method directly and they will be available in the view.</li>
|
715
|
-
<li>Mailers being in <code>app/models</code> is deprecated, use <code>app/mailers</code> instead.</li>
|
716
|
-
</ul>
|
717
|
-
<p>More Information:</p>
|
718
|
-
<ul>
|
719
|
-
<li><a href="http://lindsaar.net/2010/1/26/new-actionmailer-api-in-rails-3">New Action Mailer API in Rails 3</a></li>
|
720
|
-
<li><a href="http://lindsaar.net/2010/1/23/mail-gem-version-2-released">New Mail Gem for Ruby</a></li>
|
721
|
-
</ul>
|
722
|
-
<h3 id="credits">13 Credits</h3><p>See the <a href="http://contributors.rubyonrails.org/">full list of contributors to Rails</a> for the many people who spent many hours making Rails 3. Kudos to all of them.</p><p>Rails 3.0 Release Notes were compiled by <a href="http://lindsaar.net">Mikel Lindsaar</a>.</p>
|
723
|
-
|
724
|
-
<h3>Feedback</h3>
|
725
|
-
<p>
|
726
|
-
You're encouraged to help improve the quality of this guide.
|
727
|
-
</p>
|
728
|
-
<p>
|
729
|
-
Please contribute if you see any typos or factual errors.
|
730
|
-
To get started, you can read our <a href="http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#contributing-to-the-rails-documentation">documentation contributions</a> section.
|
731
|
-
</p>
|
732
|
-
<p>
|
733
|
-
You may also find incomplete content, or stuff that is not up to date.
|
734
|
-
Please do add any missing documentation for master. Make sure to check
|
735
|
-
<a href="http://edgeguides.rubyonrails.org">Edge Guides</a> first to verify
|
736
|
-
if the issues are already fixed or not on the master branch.
|
737
|
-
Check the <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a>
|
738
|
-
for style and conventions.
|
739
|
-
</p>
|
740
|
-
<p>
|
741
|
-
If for whatever reason you spot something to fix but cannot patch it yourself, please
|
742
|
-
<a href="https://github.com/rails/rails/issues">open an issue</a>.
|
743
|
-
</p>
|
744
|
-
<p>And last but not least, any kind of discussion regarding Ruby on Rails
|
745
|
-
documentation is very welcome in the <a href="http://groups.google.com/group/rubyonrails-docs">rubyonrails-docs mailing list</a>.
|
746
|
-
</p>
|
747
|
-
</div>
|
748
|
-
</div>
|
749
|
-
</div>
|
750
|
-
|
751
|
-
<hr class="hide" />
|
752
|
-
<div id="footer">
|
753
|
-
<div class="wrapper">
|
754
|
-
<p>This work is licensed under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International</a> License</p>
|
755
|
-
<p>"Rails", "Ruby on Rails", and the Rails logo are trademarks of David Heinemeier Hansson. All rights reserved.</p>
|
756
|
-
|
757
|
-
</div>
|
758
|
-
</div>
|
759
|
-
|
760
|
-
<script type="text/javascript" src="javascripts/jquery.min.js"></script>
|
761
|
-
<script type="text/javascript" src="javascripts/responsive-tables.js"></script>
|
762
|
-
<script type="text/javascript" src="javascripts/guides.js"></script>
|
763
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shCore.js"></script>
|
764
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushRuby.js"></script>
|
765
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushXml.js"></script>
|
766
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushSql.js"></script>
|
767
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushPlain.js"></script>
|
768
|
-
<script type="text/javascript">
|
769
|
-
SyntaxHighlighter.all();
|
770
|
-
$(guidesIndex.bind);
|
771
|
-
</script>
|
772
|
-
</body>
|
773
|
-
</html>
|