rails 4.2.0.beta4 → 4.2.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,546 +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>Active Job Basics — 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>Active Job Basics</h2><p>This guide provides you with all you need to get started in creating,
|
165
|
-
enqueueing and executing background jobs.</p><p>After reading this guide, you will know:</p>
|
166
|
-
<ul>
|
167
|
-
<li>How to create jobs.</li>
|
168
|
-
<li>How to enqueue jobs.</li>
|
169
|
-
<li>How to run jobs in the background.</li>
|
170
|
-
<li>How to send emails from your application async.</li>
|
171
|
-
</ul>
|
172
|
-
|
173
|
-
|
174
|
-
<div id="subCol">
|
175
|
-
<h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
|
176
|
-
<ol class="chapters">
|
177
|
-
<li><a href="#introduction">Introduction</a></li>
|
178
|
-
<li><a href="#the-purpose-of-the-active-job">The Purpose of the Active Job</a></li>
|
179
|
-
<li>
|
180
|
-
<a href="#creating-a-job">Creating a Job</a>
|
181
|
-
|
182
|
-
<ul>
|
183
|
-
<li><a href="#create-the-job">Create the Job</a></li>
|
184
|
-
<li><a href="#enqueue-the-job">Enqueue the Job</a></li>
|
185
|
-
</ul>
|
186
|
-
</li>
|
187
|
-
<li>
|
188
|
-
<a href="#job-execution">Job Execution</a>
|
189
|
-
|
190
|
-
<ul>
|
191
|
-
<li><a href="#backends">Backends</a></li>
|
192
|
-
<li><a href="#change-backends">Change Backends</a></li>
|
193
|
-
</ul>
|
194
|
-
</li>
|
195
|
-
<li><a href="#queues">Queues</a></li>
|
196
|
-
<li>
|
197
|
-
<a href="#callbacks">Callbacks</a>
|
198
|
-
|
199
|
-
<ul>
|
200
|
-
<li><a href="#available-callbacks">Available callbacks</a></li>
|
201
|
-
<li><a href="#usage">Usage</a></li>
|
202
|
-
</ul>
|
203
|
-
</li>
|
204
|
-
<li><a href="#actionmailer">ActionMailer</a></li>
|
205
|
-
<li><a href="#globalid">GlobalID</a></li>
|
206
|
-
<li><a href="#exceptions">Exceptions</a></li>
|
207
|
-
</ol>
|
208
|
-
|
209
|
-
</div>
|
210
|
-
|
211
|
-
</div>
|
212
|
-
</div>
|
213
|
-
|
214
|
-
<div id="container">
|
215
|
-
<div class="wrapper">
|
216
|
-
<div id="mainCol">
|
217
|
-
<h3 id="introduction">1 Introduction</h3><p>Active Job is a framework for declaring jobs and making them run on a variety
|
218
|
-
of queueing backends. These jobs can be everything from regularly scheduled
|
219
|
-
clean-ups, billing charges, or mailings. Anything that can be chopped up
|
220
|
-
into small units of work and run in parallel, really.</p><h3 id="the-purpose-of-the-active-job">2 The Purpose of the Active Job</h3><p>The main point is to ensure that all Rails apps will have a job infrastructure
|
221
|
-
in place, even if it's in the form of an "immediate runner". We can then have
|
222
|
-
framework features and other gems build on top of that, without having to
|
223
|
-
worry about API differences between various job runners such as Delayed Job
|
224
|
-
and Resque. Picking your queuing backend becomes more of an operational concern,
|
225
|
-
then. And you'll be able to switch between them without having to rewrite your jobs.</p><h3 id="creating-a-job">3 Creating a Job</h3><p>This section will provide a step-by-step guide to creating a job and enqueue it.</p><h4 id="create-the-job">3.1 Create the Job</h4><p>Active Job provides a Rails generator to create jobs. The following will create a
|
226
|
-
job in app/jobs:</p><div class="code_container">
|
227
|
-
<pre class="brush: plain; gutter: false; toolbar: false">
|
228
|
-
$ bin/rails generate job guests_cleanup
|
229
|
-
create app/jobs/guests_cleanup_job.rb
|
230
|
-
|
231
|
-
</pre>
|
232
|
-
</div>
|
233
|
-
<p>You can also create a job that will run on a specific queue:</p><div class="code_container">
|
234
|
-
<pre class="brush: plain; gutter: false; toolbar: false">
|
235
|
-
$ bin/rails generate job guests_cleanup --queue urgent
|
236
|
-
create app/jobs/guests_cleanup_job.rb
|
237
|
-
|
238
|
-
</pre>
|
239
|
-
</div>
|
240
|
-
<p>As you can see, you can generate jobs just like you use other generators with
|
241
|
-
Rails.</p><p>If you don't want to use a generator, you could create your own file inside of
|
242
|
-
app/jobs, just make sure that it inherits from <code>ActiveJob::Base</code>.</p><p>Here's how a job looks like:</p><div class="code_container">
|
243
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
244
|
-
class GuestsCleanupJob < ActiveJob::Base
|
245
|
-
queue_as :default
|
246
|
-
|
247
|
-
def perform
|
248
|
-
# Do something later
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
</pre>
|
253
|
-
</div>
|
254
|
-
<h4 id="enqueue-the-job">3.2 Enqueue the Job</h4><p>Enqueue a job like so:</p><div class="code_container">
|
255
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
256
|
-
MyJob.enqueue record # Enqueue a job to be performed as soon the queueing system is free.
|
257
|
-
|
258
|
-
</pre>
|
259
|
-
</div>
|
260
|
-
<div class="code_container">
|
261
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
262
|
-
MyJob.enqueue_at Date.tomorrow.noon, record # Enqueue a job to be performed tomorrow at noon.
|
263
|
-
|
264
|
-
</pre>
|
265
|
-
</div>
|
266
|
-
<div class="code_container">
|
267
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
268
|
-
MyJob.enqueue_in 1.week, record # Enqueue a job to be performed 1 week from now.
|
269
|
-
|
270
|
-
</pre>
|
271
|
-
</div>
|
272
|
-
<p>That's it!</p><h3 id="job-execution">4 Job Execution</h3><p>If not adapter is set, the job is immediately executed.</p><h4 id="backends">4.1 Backends</h4><p>Active Job has adapters for the following queueing backends:</p>
|
273
|
-
<ul>
|
274
|
-
<li><a href="https://github.com/nesquena/backburner">Backburner</a></li>
|
275
|
-
<li><a href="https://github.com/collectiveidea/delayed_job">Delayed Job</a></li>
|
276
|
-
<li><a href="https://github.com/bkeepers/qu">Qu</a></li>
|
277
|
-
<li><a href="https://github.com/chanks/que">Que</a></li>
|
278
|
-
<li><a href="https://github.com/ryandotsmith/queue_classic">QueueClassic</a></li>
|
279
|
-
<li><a href="https://github.com/resque/resque">Resque 1.x</a></li>
|
280
|
-
<li><a href="https://github.com/mperham/sidekiq">Sidekiq</a></li>
|
281
|
-
<li><a href="https://github.com/jondot/sneakers">Sneakers</a></li>
|
282
|
-
<li><a href="https://github.com/brandonhilkert/sucker_punch">Sucker Punch</a></li>
|
283
|
-
</ul>
|
284
|
-
<h5 id="backends-features">4.1.1 Backends Features</h5>
|
285
|
-
<table>
|
286
|
-
<thead>
|
287
|
-
<tr>
|
288
|
-
<th></th>
|
289
|
-
<th>Async</th>
|
290
|
-
<th>Queues</th>
|
291
|
-
<th>Delayed</th>
|
292
|
-
<th>Priorities</th>
|
293
|
-
<th>Timeout</th>
|
294
|
-
<th>Retries</th>
|
295
|
-
</tr>
|
296
|
-
</thead>
|
297
|
-
<tbody>
|
298
|
-
<tr>
|
299
|
-
<td><strong>Backburner</strong></td>
|
300
|
-
<td>Yes</td>
|
301
|
-
<td>Yes</td>
|
302
|
-
<td>Yes</td>
|
303
|
-
<td>Yes</td>
|
304
|
-
<td>Job</td>
|
305
|
-
<td>Global</td>
|
306
|
-
</tr>
|
307
|
-
<tr>
|
308
|
-
<td><strong>Delayed Job</strong></td>
|
309
|
-
<td>Yes</td>
|
310
|
-
<td>Yes</td>
|
311
|
-
<td>Yes</td>
|
312
|
-
<td>Job</td>
|
313
|
-
<td>Global</td>
|
314
|
-
<td>Global</td>
|
315
|
-
</tr>
|
316
|
-
<tr>
|
317
|
-
<td><strong>Que</strong></td>
|
318
|
-
<td>Yes</td>
|
319
|
-
<td>Yes</td>
|
320
|
-
<td>Yes</td>
|
321
|
-
<td>Job</td>
|
322
|
-
<td>No</td>
|
323
|
-
<td>Job</td>
|
324
|
-
</tr>
|
325
|
-
<tr>
|
326
|
-
<td><strong>Queue Classic</strong></td>
|
327
|
-
<td>Yes</td>
|
328
|
-
<td>Yes</td>
|
329
|
-
<td>Gem</td>
|
330
|
-
<td>No</td>
|
331
|
-
<td>No</td>
|
332
|
-
<td>No</td>
|
333
|
-
</tr>
|
334
|
-
<tr>
|
335
|
-
<td><strong>Resque</strong></td>
|
336
|
-
<td>Yes</td>
|
337
|
-
<td>Yes</td>
|
338
|
-
<td>Gem</td>
|
339
|
-
<td>Queue</td>
|
340
|
-
<td>Global</td>
|
341
|
-
<td>?</td>
|
342
|
-
</tr>
|
343
|
-
<tr>
|
344
|
-
<td><strong>Sidekiq</strong></td>
|
345
|
-
<td>Yes</td>
|
346
|
-
<td>Yes</td>
|
347
|
-
<td>Yes</td>
|
348
|
-
<td>Queue</td>
|
349
|
-
<td>No</td>
|
350
|
-
<td>Job</td>
|
351
|
-
</tr>
|
352
|
-
<tr>
|
353
|
-
<td><strong>Sneakers</strong></td>
|
354
|
-
<td>Yes</td>
|
355
|
-
<td>Yes</td>
|
356
|
-
<td>No</td>
|
357
|
-
<td>Queue</td>
|
358
|
-
<td>Queue</td>
|
359
|
-
<td>No</td>
|
360
|
-
</tr>
|
361
|
-
<tr>
|
362
|
-
<td><strong>Sucker Punch</strong></td>
|
363
|
-
<td>Yes</td>
|
364
|
-
<td>Yes</td>
|
365
|
-
<td>Yes</td>
|
366
|
-
<td>No</td>
|
367
|
-
<td>No</td>
|
368
|
-
<td>No</td>
|
369
|
-
</tr>
|
370
|
-
<tr>
|
371
|
-
<td><strong>Active Job</strong></td>
|
372
|
-
<td>Yes</td>
|
373
|
-
<td>Yes</td>
|
374
|
-
<td>WIP</td>
|
375
|
-
<td>No</td>
|
376
|
-
<td>No</td>
|
377
|
-
<td>No</td>
|
378
|
-
</tr>
|
379
|
-
<tr>
|
380
|
-
<td><strong>Active Job Inline</strong></td>
|
381
|
-
<td>No</td>
|
382
|
-
<td>Yes</td>
|
383
|
-
<td>N/A</td>
|
384
|
-
<td>N/A</td>
|
385
|
-
<td>N/A</td>
|
386
|
-
<td>N/A</td>
|
387
|
-
</tr>
|
388
|
-
</tbody>
|
389
|
-
</table>
|
390
|
-
<h4 id="change-backends">4.2 Change Backends</h4><p>You can easy change your adapter:</p><div class="code_container">
|
391
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
392
|
-
# be sure to have the adapter gem in your Gemfile and follow the adapter specific
|
393
|
-
# installation and deployment instructions
|
394
|
-
YourApp::Application.config.active_job.queue_adapter = :sidekiq
|
395
|
-
|
396
|
-
</pre>
|
397
|
-
</div>
|
398
|
-
<h3 id="queues">5 Queues</h3><p>Most of the adapters supports multiple queues. With Active Job you can schedule the job
|
399
|
-
to run on a specific queue:</p><div class="code_container">
|
400
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
401
|
-
class GuestsCleanupJob < ActiveJob::Base
|
402
|
-
queue_as :low_priority
|
403
|
-
#....
|
404
|
-
end
|
405
|
-
|
406
|
-
</pre>
|
407
|
-
</div>
|
408
|
-
<div class="note"><p>Make sure your queueing backend "listens" on your queue name. For some backends
|
409
|
-
you need to specify the queues to listen to.</p></div><h3 id="callbacks">6 Callbacks</h3><p>Active Job provides hooks during the lifecycle of a job. Callbacks allows you to trigger
|
410
|
-
logic during the lifecycle of a job.</p><h4 id="available-callbacks">6.1 Available callbacks</h4>
|
411
|
-
<ul>
|
412
|
-
<li>before_enqueue</li>
|
413
|
-
<li>around_enqueue</li>
|
414
|
-
<li>after_enqueue</li>
|
415
|
-
<li>before_perform</li>
|
416
|
-
<li>around_perform</li>
|
417
|
-
<li>after_perform</li>
|
418
|
-
</ul>
|
419
|
-
<h4 id="usage">6.2 Usage</h4><div class="code_container">
|
420
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
421
|
-
class GuestsCleanupJob < ActiveJob::Base
|
422
|
-
queue_as :default
|
423
|
-
|
424
|
-
before_enqueue do |job|
|
425
|
-
# do somthing with the job instance
|
426
|
-
end
|
427
|
-
|
428
|
-
around_perform do |job, block|
|
429
|
-
# do something before perform
|
430
|
-
block.call
|
431
|
-
# do something after perform
|
432
|
-
end
|
433
|
-
|
434
|
-
def perform
|
435
|
-
# Do something later
|
436
|
-
end
|
437
|
-
end
|
438
|
-
|
439
|
-
</pre>
|
440
|
-
</div>
|
441
|
-
<h3 id="actionmailer">7 ActionMailer</h3><p>One of the most common jobs in a modern web application is sending emails outside
|
442
|
-
of the request-response cycle, so the user doesn't have to wait on it. Active Job
|
443
|
-
is integrated with Action Mailer so you can easily send emails async:</p><div class="code_container">
|
444
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
445
|
-
# Instead of the classic
|
446
|
-
UserMailer.welcome(@user).deliver
|
447
|
-
|
448
|
-
# use #deliver later to send the email async
|
449
|
-
UserMailer.welcome(@user).deliver_later
|
450
|
-
|
451
|
-
</pre>
|
452
|
-
</div>
|
453
|
-
<h3 id="globalid">8 GlobalID</h3><p>Active Job supports GlobalID for parameters. This makes it possible
|
454
|
-
to pass live Active Record objects to your job instead of class/id pairs, which
|
455
|
-
you then have to manually deserialize. Before, jobs would look like this:</p><div class="code_container">
|
456
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
457
|
-
class TrashableCleanupJob
|
458
|
-
def perform(trashable_class, trashable_id, depth)
|
459
|
-
trashable = trashable_class.constantize.find(trashable_id)
|
460
|
-
trashable.cleanup(depth)
|
461
|
-
end
|
462
|
-
end
|
463
|
-
|
464
|
-
</pre>
|
465
|
-
</div>
|
466
|
-
<p>Now you can simply do:</p><div class="code_container">
|
467
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
468
|
-
class TrashableCleanupJob
|
469
|
-
def perform(trashable, depth)
|
470
|
-
trashable.cleanup(depth)
|
471
|
-
end
|
472
|
-
end
|
473
|
-
|
474
|
-
</pre>
|
475
|
-
</div>
|
476
|
-
<p>This works with any class that mixes in ActiveModel::GlobalIdentification, which
|
477
|
-
by default has been mixed into Active Model classes.</p><h3 id="exceptions">9 Exceptions</h3><p>Active Job provides a way to catch exceptions raised during the execution of the
|
478
|
-
job:</p><div class="code_container">
|
479
|
-
<pre class="brush: ruby; gutter: false; toolbar: false">
|
480
|
-
|
481
|
-
class GuestsCleanupJob < ActiveJob::Base
|
482
|
-
queue_as :default
|
483
|
-
|
484
|
-
rescue_from(ActiveRecord:NotFound) do |exception|
|
485
|
-
# do something with the exception
|
486
|
-
end
|
487
|
-
|
488
|
-
def perform
|
489
|
-
# Do something later
|
490
|
-
end
|
491
|
-
end
|
492
|
-
|
493
|
-
</pre>
|
494
|
-
</div>
|
495
|
-
|
496
|
-
|
497
|
-
<h3>Feedback</h3>
|
498
|
-
<p>
|
499
|
-
You're encouraged to help improve the quality of this guide.
|
500
|
-
</p>
|
501
|
-
<p>
|
502
|
-
Please contribute if you see any typos or factual errors.
|
503
|
-
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.
|
504
|
-
</p>
|
505
|
-
<p>
|
506
|
-
You may also find incomplete content, or stuff that is not up to date.
|
507
|
-
Please do add any missing documentation for master. Make sure to check
|
508
|
-
<a href="http://edgeguides.rubyonrails.org">Edge Guides</a> first to verify
|
509
|
-
if the issues are already fixed or not on the master branch.
|
510
|
-
Check the <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a>
|
511
|
-
for style and conventions.
|
512
|
-
</p>
|
513
|
-
<p>
|
514
|
-
If for whatever reason you spot something to fix but cannot patch it yourself, please
|
515
|
-
<a href="https://github.com/rails/rails/issues">open an issue</a>.
|
516
|
-
</p>
|
517
|
-
<p>And last but not least, any kind of discussion regarding Ruby on Rails
|
518
|
-
documentation is very welcome in the <a href="http://groups.google.com/group/rubyonrails-docs">rubyonrails-docs mailing list</a>.
|
519
|
-
</p>
|
520
|
-
</div>
|
521
|
-
</div>
|
522
|
-
</div>
|
523
|
-
|
524
|
-
<hr class="hide" />
|
525
|
-
<div id="footer">
|
526
|
-
<div class="wrapper">
|
527
|
-
<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>
|
528
|
-
<p>"Rails", "Ruby on Rails", and the Rails logo are trademarks of David Heinemeier Hansson. All rights reserved.</p>
|
529
|
-
|
530
|
-
</div>
|
531
|
-
</div>
|
532
|
-
|
533
|
-
<script type="text/javascript" src="javascripts/jquery.min.js"></script>
|
534
|
-
<script type="text/javascript" src="javascripts/responsive-tables.js"></script>
|
535
|
-
<script type="text/javascript" src="javascripts/guides.js"></script>
|
536
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shCore.js"></script>
|
537
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushRuby.js"></script>
|
538
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushXml.js"></script>
|
539
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushSql.js"></script>
|
540
|
-
<script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushPlain.js"></script>
|
541
|
-
<script type="text/javascript">
|
542
|
-
SyntaxHighlighter.all();
|
543
|
-
$(guidesIndex.bind);
|
544
|
-
</script>
|
545
|
-
</body>
|
546
|
-
</html>
|