rails 4.1.16 → 4.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/guides/CHANGELOG.md +13 -102
- data/guides/Rakefile +2 -2
- data/guides/assets/javascripts/guides.js +6 -0
- data/guides/assets/stylesheets/main.css +4 -1
- data/guides/bug_report_templates/action_controller_gem.rb +2 -2
- data/guides/bug_report_templates/action_controller_master.rb +5 -2
- data/guides/bug_report_templates/active_record_master.rb +2 -0
- data/guides/rails_guides.rb +2 -2
- data/guides/rails_guides/helpers.rb +1 -1
- data/guides/rails_guides/levenshtein.rb +29 -21
- data/guides/rails_guides/markdown.rb +6 -7
- data/guides/rails_guides/markdown/renderer.rb +1 -1
- data/guides/source/2_3_release_notes.md +3 -3
- data/guides/source/3_0_release_notes.md +4 -4
- data/guides/source/3_1_release_notes.md +2 -2
- data/guides/source/3_2_release_notes.md +2 -2
- data/guides/source/4_1_release_notes.md +8 -9
- data/guides/source/4_2_release_notes.md +572 -0
- data/guides/source/_license.html.erb +1 -1
- data/guides/source/_welcome.html.erb +2 -8
- data/guides/source/action_controller_overview.md +79 -7
- data/guides/source/action_mailer_basics.md +36 -11
- data/guides/source/action_view_overview.md +138 -119
- data/guides/source/active_job_basics.md +253 -0
- data/guides/source/active_model_basics.md +23 -0
- data/guides/source/active_record_basics.md +16 -15
- data/guides/source/active_record_callbacks.md +12 -9
- data/guides/source/{migrations.md → active_record_migrations.md} +90 -217
- data/guides/source/active_record_postgresql.md +437 -0
- data/guides/source/active_record_querying.md +261 -261
- data/guides/source/active_record_validations.md +7 -7
- data/guides/source/active_support_core_extensions.md +105 -44
- data/guides/source/active_support_instrumentation.md +3 -2
- data/guides/source/api_documentation_guidelines.md +62 -16
- data/guides/source/asset_pipeline.md +58 -46
- data/guides/source/association_basics.md +47 -38
- data/guides/source/caching_with_rails.md +31 -6
- data/guides/source/command_line.md +56 -25
- data/guides/source/configuring.md +98 -19
- data/guides/source/contributing_to_ruby_on_rails.md +174 -111
- data/guides/source/credits.html.erb +1 -1
- data/guides/source/debugging_rails_applications.md +438 -284
- data/guides/source/development_dependencies_install.md +17 -4
- data/guides/source/documents.yaml +11 -7
- data/guides/source/engines.md +192 -203
- data/guides/source/form_helpers.md +54 -45
- data/guides/source/generators.md +20 -11
- data/guides/source/getting_started.md +330 -191
- data/guides/source/i18n.md +92 -62
- data/guides/source/index.html.erb +1 -0
- data/guides/source/initialization.md +108 -59
- data/guides/source/layout.html.erb +1 -4
- data/guides/source/layouts_and_rendering.md +24 -23
- data/guides/source/nested_model_forms.md +3 -3
- data/guides/source/plugins.md +26 -26
- data/guides/source/rails_application_templates.md +21 -3
- data/guides/source/rails_on_rack.md +1 -1
- data/guides/source/routing.md +97 -71
- data/guides/source/ruby_on_rails_guides_guidelines.md +10 -12
- data/guides/source/security.md +39 -33
- data/guides/source/testing.md +111 -108
- data/guides/source/upgrading_ruby_on_rails.md +131 -14
- data/guides/source/working_with_javascript_in_rails.md +18 -16
- data/guides/w3c_validator.rb +2 -0
- metadata +37 -94
- data/guides/bug_report_templates/generic_gem.rb +0 -15
- data/guides/bug_report_templates/generic_master.rb +0 -26
- data/guides/code/getting_started/Gemfile +0 -40
- data/guides/code/getting_started/Gemfile.lock +0 -125
- data/guides/code/getting_started/README.rdoc +0 -28
- data/guides/code/getting_started/Rakefile +0 -6
- data/guides/code/getting_started/app/assets/javascripts/application.js +0 -15
- data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/application.css +0 -13
- data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss +0 -3
- data/guides/code/getting_started/app/controllers/application_controller.rb +0 -5
- data/guides/code/getting_started/app/controllers/comments_controller.rb +0 -23
- data/guides/code/getting_started/app/controllers/posts_controller.rb +0 -53
- data/guides/code/getting_started/app/controllers/welcome_controller.rb +0 -4
- data/guides/code/getting_started/app/helpers/application_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/comments_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/posts_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/welcome_helper.rb +0 -2
- data/guides/code/getting_started/app/models/comment.rb +0 -3
- data/guides/code/getting_started/app/models/post.rb +0 -7
- data/guides/code/getting_started/app/views/comments/_comment.html.erb +0 -15
- data/guides/code/getting_started/app/views/comments/_form.html.erb +0 -13
- data/guides/code/getting_started/app/views/layouts/application.html.erb +0 -14
- data/guides/code/getting_started/app/views/posts/_form.html.erb +0 -27
- data/guides/code/getting_started/app/views/posts/edit.html.erb +0 -5
- data/guides/code/getting_started/app/views/posts/index.html.erb +0 -21
- data/guides/code/getting_started/app/views/posts/new.html.erb +0 -5
- data/guides/code/getting_started/app/views/posts/show.html.erb +0 -18
- data/guides/code/getting_started/app/views/welcome/index.html.erb +0 -4
- data/guides/code/getting_started/bin/bundle +0 -4
- data/guides/code/getting_started/bin/rails +0 -4
- data/guides/code/getting_started/bin/rake +0 -4
- data/guides/code/getting_started/config.ru +0 -4
- data/guides/code/getting_started/config/application.rb +0 -18
- data/guides/code/getting_started/config/boot.rb +0 -4
- data/guides/code/getting_started/config/database.yml +0 -25
- data/guides/code/getting_started/config/environment.rb +0 -5
- data/guides/code/getting_started/config/environments/development.rb +0 -30
- data/guides/code/getting_started/config/environments/production.rb +0 -80
- data/guides/code/getting_started/config/environments/test.rb +0 -36
- data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +0 -7
- data/guides/code/getting_started/config/initializers/filter_parameter_logging.rb +0 -4
- data/guides/code/getting_started/config/initializers/inflections.rb +0 -16
- data/guides/code/getting_started/config/initializers/locale.rb +0 -9
- data/guides/code/getting_started/config/initializers/mime_types.rb +0 -5
- data/guides/code/getting_started/config/initializers/secret_token.rb +0 -12
- data/guides/code/getting_started/config/initializers/session_store.rb +0 -3
- data/guides/code/getting_started/config/initializers/wrap_parameters.rb +0 -14
- data/guides/code/getting_started/config/locales/en.yml +0 -23
- data/guides/code/getting_started/config/routes.rb +0 -7
- data/guides/code/getting_started/db/migrate/20130122042648_create_posts.rb +0 -10
- data/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb +0 -11
- data/guides/code/getting_started/db/schema.rb +0 -33
- data/guides/code/getting_started/db/seeds.rb +0 -7
- data/guides/code/getting_started/public/404.html +0 -60
- data/guides/code/getting_started/public/422.html +0 -60
- data/guides/code/getting_started/public/500.html +0 -59
- data/guides/code/getting_started/public/favicon.ico +0 -0
- data/guides/code/getting_started/public/robots.txt +0 -5
- data/guides/code/getting_started/test/controllers/comments_controller_test.rb +0 -7
- data/guides/code/getting_started/test/controllers/posts_controller_test.rb +0 -7
- data/guides/code/getting_started/test/controllers/welcome_controller_test.rb +0 -9
- data/guides/code/getting_started/test/fixtures/comments.yml +0 -11
- data/guides/code/getting_started/test/fixtures/posts.yml +0 -9
- data/guides/code/getting_started/test/helpers/comments_helper_test.rb +0 -4
- data/guides/code/getting_started/test/helpers/posts_helper_test.rb +0 -4
- data/guides/code/getting_started/test/helpers/welcome_helper_test.rb +0 -4
- data/guides/code/getting_started/test/models/comment_test.rb +0 -7
- data/guides/code/getting_started/test/models/post_test.rb +0 -7
- data/guides/code/getting_started/test/test_helper.rb +0 -12
@@ -24,6 +24,122 @@ Rails generally stays close to the latest released Ruby version when it's releas
|
|
24
24
|
|
25
25
|
TIP: Ruby 1.8.7 p248 and p249 have marshaling bugs that crash Rails. Ruby Enterprise Edition has these fixed since the release of 1.8.7-2010.02. On the 1.9 front, Ruby 1.9.1 is not usable because it outright segfaults, so if you want to use 1.9.x, jump straight to 1.9.3 for smooth sailing.
|
26
26
|
|
27
|
+
### The Rake Task
|
28
|
+
|
29
|
+
Rails provides the `rails:update` rake task. After updating the Rails version
|
30
|
+
in the Gemfile, run this rake task.
|
31
|
+
This will help you with the creation of new files and changes of old files in a
|
32
|
+
interactive session.
|
33
|
+
|
34
|
+
```bash
|
35
|
+
$ rake rails:update
|
36
|
+
identical config/boot.rb
|
37
|
+
exist config
|
38
|
+
conflict config/routes.rb
|
39
|
+
Overwrite /myapp/config/routes.rb? (enter "h" for help) [Ynaqdh]
|
40
|
+
force config/routes.rb
|
41
|
+
conflict config/application.rb
|
42
|
+
Overwrite /myapp/config/application.rb? (enter "h" for help) [Ynaqdh]
|
43
|
+
force config/application.rb
|
44
|
+
conflict config/environment.rb
|
45
|
+
...
|
46
|
+
```
|
47
|
+
|
48
|
+
Don't forget to review the difference, to see if there were any unexpected changes.
|
49
|
+
|
50
|
+
Upgrading from Rails 4.1 to Rails 4.2
|
51
|
+
-------------------------------------
|
52
|
+
|
53
|
+
NOTE: This section is a work in progress, please help to improve this by sending
|
54
|
+
a [pull request](https://github.com/rails/rails/edit/master/guides/source/upgrading_ruby_on_rails.md).
|
55
|
+
|
56
|
+
### Web Console
|
57
|
+
|
58
|
+
TODO: setup instructions for web console on existing apps.
|
59
|
+
|
60
|
+
### Responders
|
61
|
+
|
62
|
+
TODO: mention https://github.com/rails/rails/pull/16526
|
63
|
+
|
64
|
+
### Error handling in transaction callbacks
|
65
|
+
|
66
|
+
TODO: mention https://github.com/rails/rails/pull/16537
|
67
|
+
|
68
|
+
### Serialized attributes
|
69
|
+
|
70
|
+
When using a custom coder (e.g. `serialize :metadata, JSON`),
|
71
|
+
assigning `nil` to a serialized attribute will save it to the database
|
72
|
+
as `NULL` instead of passing the `nil` value through the coder (e.g. `"null"`
|
73
|
+
when using the `JSON` coder).
|
74
|
+
|
75
|
+
### `after_bundle` in Rails templates
|
76
|
+
|
77
|
+
If you have a Rails template that adds all the files in version control, it
|
78
|
+
fails to add the generated binstubs because it gets executed before Bundler:
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
# template.rb
|
82
|
+
generate(:scaffold, "person name:string")
|
83
|
+
route "root to: 'people#index'"
|
84
|
+
rake("db:migrate")
|
85
|
+
|
86
|
+
git :init
|
87
|
+
git add: "."
|
88
|
+
git commit: %Q{ -m 'Initial commit' }
|
89
|
+
```
|
90
|
+
|
91
|
+
You can now wrap the `git` calls in an `after_bundle` block. It will be run
|
92
|
+
after the binstubs have been generated.
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
# template.rb
|
96
|
+
generate(:scaffold, "person name:string")
|
97
|
+
route "root to: 'people#index'"
|
98
|
+
rake("db:migrate")
|
99
|
+
|
100
|
+
after_bundle do
|
101
|
+
git :init
|
102
|
+
git add: "."
|
103
|
+
git commit: %Q{ -m 'Initial commit' }
|
104
|
+
end
|
105
|
+
```
|
106
|
+
|
107
|
+
### Rails Html Sanitizer
|
108
|
+
|
109
|
+
There's a new choice for sanitizing HTML fragments in your applications. The
|
110
|
+
venerable html-scanner approach is now officially being deprecated in favor of
|
111
|
+
[`Rails Html Sanitizer`](https://github.com/rails/rails-html-sanitizer).
|
112
|
+
|
113
|
+
This means the methods `sanitize`, `sanitize_css`, `strip_tags` and
|
114
|
+
`strip_links` are backed by a new implementation.
|
115
|
+
|
116
|
+
In the next major Rails version `Rails Html Sanitizer` will be the default
|
117
|
+
sanitizer. It already is for new applications.
|
118
|
+
|
119
|
+
Include this in your Gemfile to try it out today:
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
gem 'rails-html-sanitizer'
|
123
|
+
```
|
124
|
+
|
125
|
+
This new sanitizer uses [Loofah](https://github.com/flavorjones/loofah) internally. Loofah in turn uses Nokogiri, which
|
126
|
+
wraps XML parsers written in both C and Java, so sanitization should be faster
|
127
|
+
no matter which Ruby version you run.
|
128
|
+
|
129
|
+
The new version updates `sanitize`, so it can take a `Loofah::Scrubber` for
|
130
|
+
powerful scrubbing.
|
131
|
+
[See some examples of scrubbers here](https://github.com/flavorjones/loofah#loofahscrubber).
|
132
|
+
|
133
|
+
Two new scrubbers have also been added: `PermitScrubber` and `TargetScrubber`.
|
134
|
+
Read the [gem's readme](https://github.com/rails/rails-html-sanitizer) for more information.
|
135
|
+
|
136
|
+
The documentation for `PermitScrubber` and `TargetScrubber` explains how you
|
137
|
+
can gain complete control over when and how elements should be stripped.
|
138
|
+
|
139
|
+
### Rails DOM Testing
|
140
|
+
|
141
|
+
TODO: Mention https://github.com/rails/rails/commit/4e97d7585a2f4788b9eed98c6cdaf4bb6f2cf5ce
|
142
|
+
|
27
143
|
Upgrading from Rails 4.0 to Rails 4.1
|
28
144
|
-------------------------------------
|
29
145
|
|
@@ -84,10 +200,10 @@ secrets, you need to:
|
|
84
200
|
|
85
201
|
2. Use your existing `secret_key_base` from the `secret_token.rb` initializer to
|
86
202
|
set the SECRET_KEY_BASE environment variable for whichever users run the Rails
|
87
|
-
app in production mode. Alternately, you can simply copy the existing
|
88
|
-
`secret_key_base` from the `secret_token.rb` initializer to `secrets.yml`
|
203
|
+
app in production mode. Alternately, you can simply copy the existing
|
204
|
+
`secret_key_base` from the `secret_token.rb` initializer to `secrets.yml`
|
89
205
|
under the `production` section, replacing '<%= ENV["SECRET_KEY_BASE"] %>'.
|
90
|
-
|
206
|
+
|
91
207
|
3. Remove the `secret_token.rb` initializer.
|
92
208
|
|
93
209
|
4. Use `rake secret` to generate new keys for the `development` and `test` sections.
|
@@ -98,7 +214,7 @@ secrets, you need to:
|
|
98
214
|
|
99
215
|
If your test helper contains a call to
|
100
216
|
`ActiveRecord::Migration.check_pending!` this can be removed. The check
|
101
|
-
is now done automatically when you `require 'test_help'`, although
|
217
|
+
is now done automatically when you `require 'rails/test_help'`, although
|
102
218
|
leaving this line in your helper is not harmful in any way.
|
103
219
|
|
104
220
|
### Cookies serializer
|
@@ -142,7 +258,7 @@ If you use the cookie session store, this would apply to the `session` and
|
|
142
258
|
|
143
259
|
Flash message keys are
|
144
260
|
[normalized to strings](https://github.com/rails/rails/commit/a668beffd64106a1e1fedb71cc25eaaa11baf0c1). They
|
145
|
-
can still be accessed using either symbols or strings.
|
261
|
+
can still be accessed using either symbols or strings. Looping through the flash
|
146
262
|
will always yield string keys:
|
147
263
|
|
148
264
|
```ruby
|
@@ -277,7 +393,7 @@ included in the newly introduced `ActiveRecord::FixtureSet.context_class`, in
|
|
277
393
|
`test_helper.rb`.
|
278
394
|
|
279
395
|
```ruby
|
280
|
-
|
396
|
+
class FixtureFileHelpers
|
281
397
|
def file_sha(path)
|
282
398
|
Digest::SHA2.hexdigest(File.read(Rails.root.join('test/fixtures', path)))
|
283
399
|
end
|
@@ -321,10 +437,10 @@ authors.compact!
|
|
321
437
|
|
322
438
|
### Changes on Default Scopes
|
323
439
|
|
324
|
-
Default scopes are no longer
|
440
|
+
Default scopes are no longer overridden by chained conditions.
|
325
441
|
|
326
442
|
In previous versions when you defined a `default_scope` in a model
|
327
|
-
it was
|
443
|
+
it was overridden by chained conditions in the same field. Now it
|
328
444
|
is merged like any other scope.
|
329
445
|
|
330
446
|
Before:
|
@@ -514,7 +630,7 @@ def update
|
|
514
630
|
respond_to do |format|
|
515
631
|
format.json do
|
516
632
|
# perform a partial update
|
517
|
-
@
|
633
|
+
@article.update params[:article]
|
518
634
|
end
|
519
635
|
|
520
636
|
format.json_patch do
|
@@ -541,7 +657,7 @@ file (in `config/application.rb`):
|
|
541
657
|
```ruby
|
542
658
|
# Require the gems listed in Gemfile, including any gems
|
543
659
|
# you've limited to :test, :development, or :production.
|
544
|
-
Bundler.require(
|
660
|
+
Bundler.require(:default, Rails.env)
|
545
661
|
```
|
546
662
|
|
547
663
|
### vendor/plugins
|
@@ -749,17 +865,18 @@ config.assets.js_compressor = :uglifier
|
|
749
865
|
Upgrading from Rails 3.1 to Rails 3.2
|
750
866
|
-------------------------------------
|
751
867
|
|
752
|
-
If your application is currently on any version of Rails older than 3.1.x, you
|
868
|
+
If your application is currently on any version of Rails older than 3.1.x, you
|
869
|
+
should upgrade to Rails 3.1 before attempting an update to Rails 3.2.
|
753
870
|
|
754
|
-
The following changes are meant for upgrading your application to
|
755
|
-
|
871
|
+
The following changes are meant for upgrading your application to the latest
|
872
|
+
3.2.x version of Rails.
|
756
873
|
|
757
874
|
### Gemfile
|
758
875
|
|
759
876
|
Make the following changes to your `Gemfile`.
|
760
877
|
|
761
878
|
```ruby
|
762
|
-
gem 'rails', '3.2.
|
879
|
+
gem 'rails', '3.2.18'
|
763
880
|
|
764
881
|
group :assets do
|
765
882
|
gem 'sass-rails', '~> 3.2.6'
|
@@ -111,7 +111,9 @@ paintIt = (element, backgroundColor, textColor) ->
|
|
111
111
|
element.style.color = textColor
|
112
112
|
|
113
113
|
$ ->
|
114
|
-
$("a[data-background-color]").click ->
|
114
|
+
$("a[data-background-color]").click (e) ->
|
115
|
+
e.preventDefault()
|
116
|
+
|
115
117
|
backgroundColor = $(this).data("background-color")
|
116
118
|
textColor = $(this).data("text-color")
|
117
119
|
paintIt(this, backgroundColor, textColor)
|
@@ -156,7 +158,7 @@ is a helper that assists with writing forms. `form_for` takes a `:remote`
|
|
156
158
|
option. It works like this:
|
157
159
|
|
158
160
|
```erb
|
159
|
-
<%= form_for(@
|
161
|
+
<%= form_for(@article, remote: true) do |f| %>
|
160
162
|
...
|
161
163
|
<% end %>
|
162
164
|
```
|
@@ -164,7 +166,7 @@ option. It works like this:
|
|
164
166
|
This will generate the following HTML:
|
165
167
|
|
166
168
|
```html
|
167
|
-
<form accept-charset="UTF-8" action="/
|
169
|
+
<form accept-charset="UTF-8" action="/articles" class="new_article" data-remote="true" id="new_article" method="post">
|
168
170
|
...
|
169
171
|
</form>
|
170
172
|
```
|
@@ -178,10 +180,10 @@ bind to the `ajax:success` event. On failure, use `ajax:error`. Check it out:
|
|
178
180
|
|
179
181
|
```coffeescript
|
180
182
|
$(document).ready ->
|
181
|
-
$("#
|
182
|
-
$("#
|
183
|
+
$("#new_article").on("ajax:success", (e, data, status, xhr) ->
|
184
|
+
$("#new_article").append xhr.responseText
|
183
185
|
).on "ajax:error", (e, xhr, status, error) ->
|
184
|
-
$("#
|
186
|
+
$("#new_article").append "<p>ERROR</p>"
|
185
187
|
```
|
186
188
|
|
187
189
|
Obviously, you'll want to be a bit more sophisticated than that, but it's a
|
@@ -194,7 +196,7 @@ is very similar to `form_for`. It has a `:remote` option that you can use like
|
|
194
196
|
this:
|
195
197
|
|
196
198
|
```erb
|
197
|
-
<%= form_tag('/
|
199
|
+
<%= form_tag('/articles', remote: true) do %>
|
198
200
|
...
|
199
201
|
<% end %>
|
200
202
|
```
|
@@ -202,7 +204,7 @@ this:
|
|
202
204
|
This will generate the following HTML:
|
203
205
|
|
204
206
|
```html
|
205
|
-
<form accept-charset="UTF-8" action="/
|
207
|
+
<form accept-charset="UTF-8" action="/articles" data-remote="true" method="post">
|
206
208
|
...
|
207
209
|
</form>
|
208
210
|
```
|
@@ -217,21 +219,21 @@ is a helper that assists with generating links. It has a `:remote` option you
|
|
217
219
|
can use like this:
|
218
220
|
|
219
221
|
```erb
|
220
|
-
<%= link_to "
|
222
|
+
<%= link_to "an article", @article, remote: true %>
|
221
223
|
```
|
222
224
|
|
223
225
|
which generates
|
224
226
|
|
225
227
|
```html
|
226
|
-
<a href="/
|
228
|
+
<a href="/articles/1" data-remote="true">an article</a>
|
227
229
|
```
|
228
230
|
|
229
231
|
You can bind to the same Ajax events as `form_for`. Here's an example. Let's
|
230
|
-
assume that we have a list of
|
232
|
+
assume that we have a list of articles that can be deleted with just one
|
231
233
|
click. We would generate some HTML like this:
|
232
234
|
|
233
235
|
```erb
|
234
|
-
<%= link_to "Delete
|
236
|
+
<%= link_to "Delete article", @article, remote: true, method: :delete %>
|
235
237
|
```
|
236
238
|
|
237
239
|
and write some CoffeeScript like this:
|
@@ -239,7 +241,7 @@ and write some CoffeeScript like this:
|
|
239
241
|
```coffeescript
|
240
242
|
$ ->
|
241
243
|
$("a[data-remote]").on "ajax:success", (e, data, status, xhr) ->
|
242
|
-
alert "The
|
244
|
+
alert "The article was deleted."
|
243
245
|
```
|
244
246
|
|
245
247
|
### button_to
|
@@ -247,14 +249,14 @@ $ ->
|
|
247
249
|
[`button_to`](http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-button_to) is a helper that helps you create buttons. It has a `:remote` option that you can call like this:
|
248
250
|
|
249
251
|
```erb
|
250
|
-
<%= button_to "
|
252
|
+
<%= button_to "An article", @article, remote: true %>
|
251
253
|
```
|
252
254
|
|
253
255
|
this generates
|
254
256
|
|
255
257
|
```html
|
256
|
-
<form action="/
|
257
|
-
<div><input type="submit" value="
|
258
|
+
<form action="/articles/1" class="button_to" data-remote="true" method="post">
|
259
|
+
<div><input type="submit" value="An article"></div>
|
258
260
|
</form>
|
259
261
|
```
|
260
262
|
|
data/guides/w3c_validator.rb
CHANGED
@@ -60,6 +60,8 @@ module RailsGuides
|
|
60
60
|
def guides_to_validate
|
61
61
|
guides = Dir["./output/*.html"]
|
62
62
|
guides.delete("./output/layout.html")
|
63
|
+
guides.delete("./output/_license.html")
|
64
|
+
guides.delete("./output/_welcome.html")
|
63
65
|
ENV.key?('ONLY') ? select_only(guides) : guides
|
64
66
|
end
|
65
67
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,98 +16,112 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
19
|
+
version: 4.2.0.beta1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.
|
26
|
+
version: 4.2.0.beta1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.
|
33
|
+
version: 4.2.0.beta1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 4.
|
40
|
+
version: 4.2.0.beta1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: actionview
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.
|
47
|
+
version: 4.2.0.beta1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.
|
54
|
+
version: 4.2.0.beta1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activemodel
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 4.
|
61
|
+
version: 4.2.0.beta1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.
|
68
|
+
version: 4.2.0.beta1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activerecord
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 4.
|
75
|
+
version: 4.2.0.beta1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 4.
|
82
|
+
version: 4.2.0.beta1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: actionmailer
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 4.
|
89
|
+
version: 4.2.0.beta1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 4.
|
96
|
+
version: 4.2.0.beta1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: activejob
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 4.2.0.beta1
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 4.2.0.beta1
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: railties
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - '='
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 4.
|
117
|
+
version: 4.2.0.beta1
|
104
118
|
type: :runtime
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - '='
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 4.
|
124
|
+
version: 4.2.0.beta1
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: bundler
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,14 +148,14 @@ dependencies:
|
|
134
148
|
requirements:
|
135
149
|
- - "~>"
|
136
150
|
- !ruby/object:Gem::Version
|
137
|
-
version:
|
151
|
+
version: 3.0.0.beta1
|
138
152
|
type: :runtime
|
139
153
|
prerelease: false
|
140
154
|
version_requirements: !ruby/object:Gem::Requirement
|
141
155
|
requirements:
|
142
156
|
- - "~>"
|
143
157
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
158
|
+
version: 3.0.0.beta1
|
145
159
|
description: Ruby on Rails is a full-stack web framework optimized for programmer
|
146
160
|
happiness and sustainable productivity. It encourages beautiful code by favoring
|
147
161
|
convention over configuration.
|
@@ -294,80 +308,6 @@ files:
|
|
294
308
|
- guides/bug_report_templates/action_controller_master.rb
|
295
309
|
- guides/bug_report_templates/active_record_gem.rb
|
296
310
|
- guides/bug_report_templates/active_record_master.rb
|
297
|
-
- guides/bug_report_templates/generic_gem.rb
|
298
|
-
- guides/bug_report_templates/generic_master.rb
|
299
|
-
- guides/code/getting_started/Gemfile
|
300
|
-
- guides/code/getting_started/Gemfile.lock
|
301
|
-
- guides/code/getting_started/README.rdoc
|
302
|
-
- guides/code/getting_started/Rakefile
|
303
|
-
- guides/code/getting_started/app/assets/javascripts/application.js
|
304
|
-
- guides/code/getting_started/app/assets/javascripts/comments.js.coffee
|
305
|
-
- guides/code/getting_started/app/assets/javascripts/posts.js.coffee
|
306
|
-
- guides/code/getting_started/app/assets/javascripts/welcome.js.coffee
|
307
|
-
- guides/code/getting_started/app/assets/stylesheets/application.css
|
308
|
-
- guides/code/getting_started/app/assets/stylesheets/comments.css.scss
|
309
|
-
- guides/code/getting_started/app/assets/stylesheets/posts.css.scss
|
310
|
-
- guides/code/getting_started/app/assets/stylesheets/welcome.css.scss
|
311
|
-
- guides/code/getting_started/app/controllers/application_controller.rb
|
312
|
-
- guides/code/getting_started/app/controllers/comments_controller.rb
|
313
|
-
- guides/code/getting_started/app/controllers/posts_controller.rb
|
314
|
-
- guides/code/getting_started/app/controllers/welcome_controller.rb
|
315
|
-
- guides/code/getting_started/app/helpers/application_helper.rb
|
316
|
-
- guides/code/getting_started/app/helpers/comments_helper.rb
|
317
|
-
- guides/code/getting_started/app/helpers/posts_helper.rb
|
318
|
-
- guides/code/getting_started/app/helpers/welcome_helper.rb
|
319
|
-
- guides/code/getting_started/app/models/comment.rb
|
320
|
-
- guides/code/getting_started/app/models/post.rb
|
321
|
-
- guides/code/getting_started/app/views/comments/_comment.html.erb
|
322
|
-
- guides/code/getting_started/app/views/comments/_form.html.erb
|
323
|
-
- guides/code/getting_started/app/views/layouts/application.html.erb
|
324
|
-
- guides/code/getting_started/app/views/posts/_form.html.erb
|
325
|
-
- guides/code/getting_started/app/views/posts/edit.html.erb
|
326
|
-
- guides/code/getting_started/app/views/posts/index.html.erb
|
327
|
-
- guides/code/getting_started/app/views/posts/new.html.erb
|
328
|
-
- guides/code/getting_started/app/views/posts/show.html.erb
|
329
|
-
- guides/code/getting_started/app/views/welcome/index.html.erb
|
330
|
-
- guides/code/getting_started/bin/bundle
|
331
|
-
- guides/code/getting_started/bin/rails
|
332
|
-
- guides/code/getting_started/bin/rake
|
333
|
-
- guides/code/getting_started/config.ru
|
334
|
-
- guides/code/getting_started/config/application.rb
|
335
|
-
- guides/code/getting_started/config/boot.rb
|
336
|
-
- guides/code/getting_started/config/database.yml
|
337
|
-
- guides/code/getting_started/config/environment.rb
|
338
|
-
- guides/code/getting_started/config/environments/development.rb
|
339
|
-
- guides/code/getting_started/config/environments/production.rb
|
340
|
-
- guides/code/getting_started/config/environments/test.rb
|
341
|
-
- guides/code/getting_started/config/initializers/backtrace_silencers.rb
|
342
|
-
- guides/code/getting_started/config/initializers/filter_parameter_logging.rb
|
343
|
-
- guides/code/getting_started/config/initializers/inflections.rb
|
344
|
-
- guides/code/getting_started/config/initializers/locale.rb
|
345
|
-
- guides/code/getting_started/config/initializers/mime_types.rb
|
346
|
-
- guides/code/getting_started/config/initializers/secret_token.rb
|
347
|
-
- guides/code/getting_started/config/initializers/session_store.rb
|
348
|
-
- guides/code/getting_started/config/initializers/wrap_parameters.rb
|
349
|
-
- guides/code/getting_started/config/locales/en.yml
|
350
|
-
- guides/code/getting_started/config/routes.rb
|
351
|
-
- guides/code/getting_started/db/migrate/20130122042648_create_posts.rb
|
352
|
-
- guides/code/getting_started/db/migrate/20130122045842_create_comments.rb
|
353
|
-
- guides/code/getting_started/db/schema.rb
|
354
|
-
- guides/code/getting_started/db/seeds.rb
|
355
|
-
- guides/code/getting_started/public/404.html
|
356
|
-
- guides/code/getting_started/public/422.html
|
357
|
-
- guides/code/getting_started/public/500.html
|
358
|
-
- guides/code/getting_started/public/favicon.ico
|
359
|
-
- guides/code/getting_started/public/robots.txt
|
360
|
-
- guides/code/getting_started/test/controllers/comments_controller_test.rb
|
361
|
-
- guides/code/getting_started/test/controllers/posts_controller_test.rb
|
362
|
-
- guides/code/getting_started/test/controllers/welcome_controller_test.rb
|
363
|
-
- guides/code/getting_started/test/fixtures/comments.yml
|
364
|
-
- guides/code/getting_started/test/fixtures/posts.yml
|
365
|
-
- guides/code/getting_started/test/helpers/comments_helper_test.rb
|
366
|
-
- guides/code/getting_started/test/helpers/posts_helper_test.rb
|
367
|
-
- guides/code/getting_started/test/helpers/welcome_helper_test.rb
|
368
|
-
- guides/code/getting_started/test/models/comment_test.rb
|
369
|
-
- guides/code/getting_started/test/models/post_test.rb
|
370
|
-
- guides/code/getting_started/test/test_helper.rb
|
371
311
|
- guides/rails_guides.rb
|
372
312
|
- guides/rails_guides/generator.rb
|
373
313
|
- guides/rails_guides/helpers.rb
|
@@ -383,14 +323,18 @@ files:
|
|
383
323
|
- guides/source/3_2_release_notes.md
|
384
324
|
- guides/source/4_0_release_notes.md
|
385
325
|
- guides/source/4_1_release_notes.md
|
326
|
+
- guides/source/4_2_release_notes.md
|
386
327
|
- guides/source/_license.html.erb
|
387
328
|
- guides/source/_welcome.html.erb
|
388
329
|
- guides/source/action_controller_overview.md
|
389
330
|
- guides/source/action_mailer_basics.md
|
390
331
|
- guides/source/action_view_overview.md
|
332
|
+
- guides/source/active_job_basics.md
|
391
333
|
- guides/source/active_model_basics.md
|
392
334
|
- guides/source/active_record_basics.md
|
393
335
|
- guides/source/active_record_callbacks.md
|
336
|
+
- guides/source/active_record_migrations.md
|
337
|
+
- guides/source/active_record_postgresql.md
|
394
338
|
- guides/source/active_record_querying.md
|
395
339
|
- guides/source/active_record_validations.md
|
396
340
|
- guides/source/active_support_core_extensions.md
|
@@ -422,7 +366,6 @@ files:
|
|
422
366
|
- guides/source/layout.html.erb
|
423
367
|
- guides/source/layouts_and_rendering.md
|
424
368
|
- guides/source/maintenance_policy.md
|
425
|
-
- guides/source/migrations.md
|
426
369
|
- guides/source/nested_model_forms.md
|
427
370
|
- guides/source/plugins.md
|
428
371
|
- guides/source/rails_application_templates.md
|
@@ -454,7 +397,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
454
397
|
version: 1.8.11
|
455
398
|
requirements: []
|
456
399
|
rubyforge_project:
|
457
|
-
rubygems_version: 2.
|
400
|
+
rubygems_version: 2.2.2
|
458
401
|
signing_key:
|
459
402
|
specification_version: 4
|
460
403
|
summary: Full-stack web application framework.
|