rails 4.2.0 → 4.2.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/guides/CHANGELOG.md +82 -0
- data/guides/Rakefile +16 -3
- data/guides/assets/images/getting_started/article_with_comments.png +0 -0
- data/guides/bug_report_templates/action_controller_gem.rb +1 -1
- data/guides/bug_report_templates/active_record_gem.rb +1 -1
- data/guides/bug_report_templates/generic_gem.rb +15 -0
- data/guides/bug_report_templates/generic_master.rb +26 -0
- data/guides/rails_guides/levenshtein.rb +0 -2
- data/guides/source/3_1_release_notes.md +1 -1
- data/guides/source/4_2_release_notes.md +27 -0
- data/guides/source/_welcome.html.erb +5 -1
- data/guides/source/action_controller_overview.md +2 -59
- data/guides/source/action_mailer_basics.md +8 -3
- data/guides/source/action_view_overview.md +2 -61
- data/guides/source/active_job_basics.md +27 -6
- data/guides/source/active_record_basics.md +6 -6
- data/guides/source/active_record_querying.md +1 -3
- data/guides/source/active_record_validations.md +3 -2
- data/guides/source/active_support_core_extensions.md +2 -50
- data/guides/source/active_support_instrumentation.md +0 -11
- data/guides/source/api_documentation_guidelines.md +1 -1
- data/guides/source/asset_pipeline.md +7 -63
- data/guides/source/association_basics.md +16 -7
- data/guides/source/{constant_autoloading_and_reloading.md → autoloading_and_reloading_constants.md} +42 -28
- data/guides/source/configuring.md +30 -5
- data/guides/source/contributing_to_ruby_on_rails.md +7 -3
- data/guides/source/documents.yaml +3 -3
- data/guides/source/engines.md +10 -10
- data/guides/source/getting_started.md +33 -32
- data/guides/source/i18n.md +3 -2
- data/guides/source/initialization.md +1 -1
- data/guides/source/layout.html.erb +4 -7
- data/guides/source/layouts_and_rendering.md +8 -9
- data/guides/source/rails_on_rack.md +0 -1
- data/guides/source/routing.md +15 -1
- data/guides/source/security.md +1 -1
- data/guides/source/testing.md +12 -3
- data/guides/source/upgrading_ruby_on_rails.md +35 -3
- data/guides/source/working_with_javascript_in_rails.md +1 -1
- metadata +22 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d4073c294efe444213b93605bd058bdfcfe7fd21df0673d411aaacb8444d6311
|
4
|
+
data.tar.gz: 6ced0776f690d103fd1ae235809fe9244f59538b6153c5f75247e76a35c9f600
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e399f8b1df884ceb451de70d9e0a821f1a0c4621eb7ee8af0e9fdc1a955661aab731e6b9a7b3928f09d2a86d492ec737f5c488709d2ba734cbb9a42a1ef5e829
|
7
|
+
data.tar.gz: d302ab1709953482477f8ca896e45e54d69c8dcc16edf1f49e09ce1c8b451d0a1725baf3d3c7a2b138b97ca0018813e2cf907db01768188a8a025e68c4679b16
|
data/guides/CHANGELOG.md
CHANGED
@@ -1,3 +1,85 @@
|
|
1
|
+
## Rails 4.2.11.3 (May 15, 2020) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 4.2.11.2 (May 15, 2020) ##
|
7
|
+
|
8
|
+
* No changes.
|
9
|
+
|
10
|
+
|
11
|
+
## Rails 4.2.11.1 (March 11, 2019) ##
|
12
|
+
|
13
|
+
* No changes.
|
14
|
+
|
15
|
+
|
16
|
+
## Rails 4.2.11 (November 27, 2018) ##
|
17
|
+
|
18
|
+
* No changes.
|
19
|
+
|
20
|
+
|
21
|
+
## Rails 4.2.10 (September 27, 2017) ##
|
22
|
+
|
23
|
+
* No changes.
|
24
|
+
|
25
|
+
|
26
|
+
## Rails 4.2.9 (June 26, 2017) ##
|
27
|
+
|
28
|
+
* No changes.
|
29
|
+
|
30
|
+
|
31
|
+
## Rails 4.2.8 (February 21, 2017) ##
|
32
|
+
|
33
|
+
* No changes.
|
34
|
+
|
35
|
+
|
36
|
+
## Rails 4.2.7 (July 12, 2016) ##
|
37
|
+
|
38
|
+
* No changes.
|
39
|
+
|
40
|
+
|
41
|
+
## Rails 4.2.6 (March 07, 2016) ##
|
42
|
+
|
43
|
+
* No changes.
|
44
|
+
|
45
|
+
|
46
|
+
## Rails 4.2.5.2 (February 26, 2016) ##
|
47
|
+
|
48
|
+
* No changes.
|
49
|
+
|
50
|
+
|
51
|
+
## Rails 4.2.5.1 (January 25, 2016) ##
|
52
|
+
|
53
|
+
* No changes.
|
54
|
+
|
55
|
+
|
56
|
+
## Rails 4.2.5 (November 12, 2015) ##
|
57
|
+
|
58
|
+
* No changes.
|
59
|
+
|
60
|
+
|
61
|
+
## Rails 4.2.4 (August 24, 2015) ##
|
62
|
+
|
63
|
+
* No Changes *
|
64
|
+
|
65
|
+
|
66
|
+
## Rails 4.2.3 (June 25, 2015) ##
|
67
|
+
|
68
|
+
* No Changes *
|
69
|
+
|
70
|
+
|
71
|
+
## Rails 4.2.2 (June 16, 2015) ##
|
72
|
+
|
73
|
+
* No Changes *
|
74
|
+
|
75
|
+
|
76
|
+
## Rails 4.2.1 (March 19, 2015) ##
|
77
|
+
|
78
|
+
* No changes.
|
79
|
+
|
80
|
+
|
81
|
+
## Rails 4.2.0 (December 20, 2014) ##
|
82
|
+
|
1
83
|
* New guide about constant autoloading and reloading.
|
2
84
|
|
3
85
|
*Xavier Noria*
|
data/guides/Rakefile
CHANGED
@@ -3,16 +3,29 @@ namespace :guides do
|
|
3
3
|
desc 'Generate guides (for authors), use ONLY=foo to process just "foo.md"'
|
4
4
|
task :generate => 'generate:html'
|
5
5
|
|
6
|
+
# Guides are written in UTF-8, but the environment may be configured for some
|
7
|
+
# other locale, these tasks are responsible for ensuring the default external
|
8
|
+
# encoding is UTF-8.
|
9
|
+
#
|
10
|
+
# Real use cases: Generation was reported to fail on a machine configured with
|
11
|
+
# GBK (Chinese). The docs server once got misconfigured somehow and had "C",
|
12
|
+
# which broke generation too.
|
13
|
+
task :encoding do
|
14
|
+
%w(LANG LANGUAGE LC_ALL).each do |env_var|
|
15
|
+
ENV[env_var] = "en_US.UTF-8"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
6
19
|
namespace :generate do
|
7
20
|
|
8
21
|
desc "Generate HTML guides"
|
9
|
-
task :html do
|
22
|
+
task :html => :encoding do
|
10
23
|
ENV["WARN_BROKEN_LINKS"] = "1" # authors can't disable this
|
11
24
|
ruby "rails_guides.rb"
|
12
25
|
end
|
13
26
|
|
14
27
|
desc "Generate .mobi file. The kindlegen executable must be in your PATH. You can get it for free from http://www.amazon.com/kindlepublishing"
|
15
|
-
task :kindle do
|
28
|
+
task :kindle => :encoding do
|
16
29
|
unless `kindlerb -v 2> /dev/null` =~ /kindlerb 0.1.1/
|
17
30
|
abort "Please `gem install kindlerb` and make sure you have `kindlegen` in your PATH"
|
18
31
|
end
|
@@ -26,7 +39,7 @@ namespace :guides do
|
|
26
39
|
|
27
40
|
# Validate guides -------------------------------------------------------------------------
|
28
41
|
desc 'Validate guides, use ONLY=foo to process just "foo.html"'
|
29
|
-
task :validate do
|
42
|
+
task :validate => :encoding do
|
30
43
|
ruby "w3c_validator.rb"
|
31
44
|
end
|
32
45
|
|
Binary file
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Activate the gems you are reporting the issue against.
|
2
|
+
gem 'activesupport', '4.2.0'
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/core_ext/object/blank'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
|
7
|
+
# Ensure backward compatibility with Minitest 4
|
8
|
+
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
|
9
|
+
|
10
|
+
class BugTest < Minitest::Test
|
11
|
+
def test_stuff
|
12
|
+
assert "zomg".present?
|
13
|
+
refute "".present?
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
unless File.exist?('Gemfile')
|
2
|
+
File.write('Gemfile', <<-GEMFILE)
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
gem 'rails', github: 'rails/rails'
|
5
|
+
gem 'arel', github: 'rails/arel'
|
6
|
+
GEMFILE
|
7
|
+
|
8
|
+
system 'bundle'
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'bundler'
|
12
|
+
Bundler.setup(:default)
|
13
|
+
|
14
|
+
require 'active_support'
|
15
|
+
require 'active_support/core_ext/object/blank'
|
16
|
+
require 'minitest/autorun'
|
17
|
+
|
18
|
+
# Ensure backward compatibility with Minitest 4
|
19
|
+
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
|
20
|
+
|
21
|
+
class BugTest < Minitest::Test
|
22
|
+
def test_stuff
|
23
|
+
assert "zomg".present?
|
24
|
+
refute "".present?
|
25
|
+
end
|
26
|
+
end
|
@@ -172,7 +172,7 @@ Rails Architectural Changes
|
|
172
172
|
|
173
173
|
The major change in Rails 3.1 is the Assets Pipeline. It makes CSS and JavaScript first-class code citizens and enables proper organization, including use in plugins and engines.
|
174
174
|
|
175
|
-
The assets pipeline is powered by [Sprockets](https://github.com/
|
175
|
+
The assets pipeline is powered by [Sprockets](https://github.com/rails/sprockets) and is covered in the [Asset Pipeline](asset_pipeline.html) guide.
|
176
176
|
|
177
177
|
### HTTP Streaming
|
178
178
|
|
@@ -90,6 +90,9 @@ Post.find(2) # Subsequent calls reuse the cached prepared statement
|
|
90
90
|
Post.find_by_title('first post')
|
91
91
|
Post.find_by_title('second post')
|
92
92
|
|
93
|
+
Post.find_by(title: 'first post')
|
94
|
+
Post.find_by(title: 'second post')
|
95
|
+
|
93
96
|
post.comments
|
94
97
|
post.comments(true)
|
95
98
|
```
|
@@ -297,6 +300,30 @@ application is using any of these spellings, you will need to update them:
|
|
297
300
|
assert_select('p', 'AT&T') # => false
|
298
301
|
```
|
299
302
|
|
303
|
+
Furthermore substitutions have changed syntax.
|
304
|
+
|
305
|
+
Now you have to use a `:match` CSS-like selector:
|
306
|
+
|
307
|
+
```ruby
|
308
|
+
assert_select ":match('id', ?)", 'comment_1'
|
309
|
+
```
|
310
|
+
|
311
|
+
Additionally Regexp substitutions look different when the assertion fails.
|
312
|
+
Notice how `/hello/` here:
|
313
|
+
|
314
|
+
```ruby
|
315
|
+
assert_select(":match('id', ?)", /hello/)
|
316
|
+
```
|
317
|
+
|
318
|
+
becomes `"(?-mix:hello)"`:
|
319
|
+
|
320
|
+
```
|
321
|
+
Expected at least 1 element matching "div:match('id', "(?-mix:hello)")", found 0..
|
322
|
+
Expected 0 to be >= 1.
|
323
|
+
```
|
324
|
+
|
325
|
+
See the [Rails Dom Testing](https://github.com/rails/rails-dom-testing/tree/8798b9349fb9540ad8cb9a0ce6cb88d1384a210b) documentation for more on `assert_select`.
|
326
|
+
|
300
327
|
|
301
328
|
Railties
|
302
329
|
--------
|
@@ -15,5 +15,9 @@
|
|
15
15
|
</p>
|
16
16
|
<% end %>
|
17
17
|
<p>
|
18
|
-
The guides for earlier releases:
|
18
|
+
The guides for earlier releases:
|
19
|
+
<a href="http://guides.rubyonrails.org/v4.1/">Rails 4.1</a>,
|
20
|
+
<a href="http://guides.rubyonrails.org/v4.0/">Rails 4.0</a>,
|
21
|
+
<a href="http://guides.rubyonrails.org/v3.2/">Rails 3.2</a>, and
|
22
|
+
<a href="http://guides.rubyonrails.org/v2.3/">Rails 2.3</a>.
|
19
23
|
</p>
|
@@ -735,7 +735,7 @@ You can choose not to yield and build the response yourself, in which case the a
|
|
735
735
|
|
736
736
|
While the most common way to use filters is by creating private methods and using *_action to add them, there are two other ways to do the same thing.
|
737
737
|
|
738
|
-
The first is to use a block directly with the
|
738
|
+
The first is to use a block directly with the *\_action methods. The block receives the controller as an argument, and the `require_login` filter from above could be rewritten to use a block:
|
739
739
|
|
740
740
|
```ruby
|
741
741
|
class ApplicationController < ActionController::Base
|
@@ -1164,67 +1164,10 @@ class ClientsController < ApplicationController
|
|
1164
1164
|
end
|
1165
1165
|
```
|
1166
1166
|
|
1167
|
-
WARNING: You shouldn't do `rescue_from Exception` or `rescue_from StandardError` unless you have a particular reason as it will cause serious side-effects (e.g. you won't be able to see exception details and tracebacks during development).
|
1167
|
+
WARNING: You shouldn't do `rescue_from Exception` or `rescue_from StandardError` unless you have a particular reason as it will cause serious side-effects (e.g. you won't be able to see exception details and tracebacks during development).
|
1168
1168
|
|
1169
1169
|
NOTE: Certain exceptions are only rescuable from the `ApplicationController` class, as they are raised before the controller gets initialized and the action gets executed. See Pratik Naik's [article](http://m.onkey.org/2008/7/20/rescue-from-dispatching) on the subject for more information.
|
1170
1170
|
|
1171
|
-
|
1172
|
-
### Custom errors page
|
1173
|
-
|
1174
|
-
You can customize the layout of your error handling using controllers and views.
|
1175
|
-
First define your app own routes to display the errors page.
|
1176
|
-
|
1177
|
-
* `config/application.rb`
|
1178
|
-
|
1179
|
-
```ruby
|
1180
|
-
config.exceptions_app = self.routes
|
1181
|
-
```
|
1182
|
-
|
1183
|
-
* `config/routes.rb`
|
1184
|
-
|
1185
|
-
```ruby
|
1186
|
-
match '/404', via: :all, to: 'errors#not_found'
|
1187
|
-
match '/422', via: :all, to: 'errors#unprocessable_entity'
|
1188
|
-
match '/500', via: :all, to: 'errors#server_error'
|
1189
|
-
```
|
1190
|
-
|
1191
|
-
Create the controller and views.
|
1192
|
-
|
1193
|
-
* `app/controllers/errors_controller.rb`
|
1194
|
-
|
1195
|
-
```ruby
|
1196
|
-
class ErrorsController < ActionController::Base
|
1197
|
-
layout 'error'
|
1198
|
-
|
1199
|
-
def not_found
|
1200
|
-
render status: :not_found
|
1201
|
-
end
|
1202
|
-
|
1203
|
-
def unprocessable_entity
|
1204
|
-
render status: :unprocessable_entity
|
1205
|
-
end
|
1206
|
-
|
1207
|
-
def server_error
|
1208
|
-
render status: :server_error
|
1209
|
-
end
|
1210
|
-
end
|
1211
|
-
```
|
1212
|
-
|
1213
|
-
* `app/views`
|
1214
|
-
|
1215
|
-
```
|
1216
|
-
errors/
|
1217
|
-
not_found.html.erb
|
1218
|
-
unprocessable_entity.html.erb
|
1219
|
-
server_error.html.erb
|
1220
|
-
layouts/
|
1221
|
-
error.html.erb
|
1222
|
-
```
|
1223
|
-
|
1224
|
-
Do not forget to set the correct status code on the controller as shown before.
|
1225
|
-
|
1226
|
-
WARNING: You should avoid using the database or any complex operations because the user is already on the error page. Generating another error while on an error page could cause issues like presenting an empty page for the users.
|
1227
|
-
|
1228
1171
|
Force HTTPS protocol
|
1229
1172
|
--------------------
|
1230
1173
|
|
@@ -48,7 +48,7 @@ create test/mailers/previews/user_mailer_preview.rb
|
|
48
48
|
```ruby
|
49
49
|
# app/mailers/application_mailer.rb
|
50
50
|
class ApplicationMailer < ActionMailer::Base
|
51
|
-
default "from@example.com"
|
51
|
+
default from: "from@example.com"
|
52
52
|
layout 'mailer'
|
53
53
|
end
|
54
54
|
|
@@ -507,6 +507,9 @@ url helper.
|
|
507
507
|
<%= user_url(@user, host: 'example.com') %>
|
508
508
|
```
|
509
509
|
|
510
|
+
NOTE: non-`GET` links require [jQuery UJS](https://github.com/rails/jquery-ujs)
|
511
|
+
and won't work in mailer templates. They will result in normal `GET` requests.
|
512
|
+
|
510
513
|
### Sending Multipart Emails
|
511
514
|
|
512
515
|
Action Mailer will automatically send multipart emails if you have different
|
@@ -670,7 +673,7 @@ files (environment.rb, production.rb, etc...)
|
|
670
673
|
| Configuration | Description |
|
671
674
|
|---------------|-------------|
|
672
675
|
|`logger`|Generates information on the mailing run if available. Can be set to `nil` for no logging. Compatible with both Ruby's own `Logger` and `Log4r` loggers.|
|
673
|
-
|`smtp_settings`|Allows detailed configuration for `:smtp` delivery method:<ul><li>`:address` - Allows you to use a remote mail server. Just change it from its default `"localhost"` setting.</li><li>`:port` - On the off chance that your mail server doesn't run on port 25, you can change it.</li><li>`:domain` - If you need to specify a HELO domain, you can do it here.</li><li>`:user_name` - If your mail server requires authentication, set the username in this setting.</li><li>`:password` - If your mail server requires authentication, set the password in this setting.</li><li>`:authentication` - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of `:plain
|
676
|
+
|`smtp_settings`|Allows detailed configuration for `:smtp` delivery method:<ul><li>`:address` - Allows you to use a remote mail server. Just change it from its default `"localhost"` setting.</li><li>`:port` - On the off chance that your mail server doesn't run on port 25, you can change it.</li><li>`:domain` - If you need to specify a HELO domain, you can do it here.</li><li>`:user_name` - If your mail server requires authentication, set the username in this setting.</li><li>`:password` - If your mail server requires authentication, set the password in this setting.</li><li>`:authentication` - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of `:plain` (will send the password in the clear), `:login` (will send password Base64 encoded) or `:cram_md5` (combines a Challenge/Response mechanism to exchange information and a cryptographic Message Digest 5 algorithm to hash important information)</li><li>`:enable_starttls_auto` - Detects if STARTTLS is enabled in your SMTP server and starts to use it. Defaults to `true`.</li><li>`:openssl_verify_mode` - When using TLS, you can set how OpenSSL checks the certificate. This is really useful if you need to validate a self-signed and/or a wildcard certificate. You can use the name of an OpenSSL verify constant ('none', 'peer', 'client_once', 'fail_if_no_peer_cert') or directly the constant (`OpenSSL::SSL::VERIFY_NONE`, `OpenSSL::SSL::VERIFY_PEER`, ...).</li></ul>|
|
674
677
|
|`sendmail_settings`|Allows you to override options for the `:sendmail` delivery method.<ul><li>`:location` - The location of the sendmail executable. Defaults to `/usr/sbin/sendmail`.</li><li>`:arguments` - The command line arguments to be passed to sendmail. Defaults to `-i -t`.</li></ul>|
|
675
678
|
|`raise_delivery_errors`|Whether or not errors should be raised if the email fails to be delivered. This only works if the external email server is configured for immediate delivery.|
|
676
679
|
|`delivery_method`|Defines a delivery method. Possible values are:<ul><li>`:smtp` (default), can be configured by using `config.action_mailer.smtp_settings`.</li><li>`:sendmail`, can be configured by using `config.action_mailer.sendmail_settings`.</li><li>`:file`: save emails to files; can be configured by using `config.action_mailer.file_settings`.</li><li>`:test`: save emails to `ActionMailer::Base.deliveries` array.</li></ul>See [API docs](http://api.rubyonrails.org/classes/ActionMailer/Base.html) for more info.|
|
@@ -743,7 +746,9 @@ Mailer framework. You can do this in an initializer file
|
|
743
746
|
`config/initializers/sandbox_email_interceptor.rb`
|
744
747
|
|
745
748
|
```ruby
|
746
|
-
|
749
|
+
if Rails.env.staging?
|
750
|
+
ActionMailer::Base.register_interceptor(SandboxEmailInterceptor)
|
751
|
+
end
|
747
752
|
```
|
748
753
|
|
749
754
|
NOTE: The example above uses a custom environment called "staging" for a
|
@@ -435,39 +435,13 @@ config.action_controller.asset_host = "assets.example.com"
|
|
435
435
|
image_tag("rails.png") # => <img src="http://assets.example.com/images/rails.png" alt="Rails" />
|
436
436
|
```
|
437
437
|
|
438
|
-
#### register_javascript_expansion
|
439
|
-
|
440
|
-
Register one or more JavaScript files to be included when symbol is passed to javascript_include_tag. This method is typically intended to be called from plugin initialization to register JavaScript files that the plugin installed in `vendor/assets/javascripts`.
|
441
|
-
|
442
|
-
```ruby
|
443
|
-
ActionView::Helpers::AssetTagHelper.register_javascript_expansion monkey: ["head", "body", "tail"]
|
444
|
-
|
445
|
-
javascript_include_tag :monkey # =>
|
446
|
-
<script src="/assets/head.js"></script>
|
447
|
-
<script src="/assets/body.js"></script>
|
448
|
-
<script src="/assets/tail.js"></script>
|
449
|
-
```
|
450
|
-
|
451
|
-
#### register_stylesheet_expansion
|
452
|
-
|
453
|
-
Register one or more stylesheet files to be included when symbol is passed to `stylesheet_link_tag`. This method is typically intended to be called from plugin initialization to register stylesheet files that the plugin installed in `vendor/assets/stylesheets`.
|
454
|
-
|
455
|
-
```ruby
|
456
|
-
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion monkey: ["head", "body", "tail"]
|
457
|
-
|
458
|
-
stylesheet_link_tag :monkey # =>
|
459
|
-
<link href="/assets/head.css" media="screen" rel="stylesheet" />
|
460
|
-
<link href="/assets/body.css" media="screen" rel="stylesheet" />
|
461
|
-
<link href="/assets/tail.css" media="screen" rel="stylesheet" />
|
462
|
-
```
|
463
|
-
|
464
438
|
#### auto_discovery_link_tag
|
465
439
|
|
466
440
|
Returns a link tag that browsers and feed readers can use to auto-detect an RSS or Atom feed.
|
467
441
|
|
468
442
|
```ruby
|
469
|
-
auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", {title: "RSS Feed"}) # =>
|
470
|
-
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://www.example.com/feed" />
|
443
|
+
auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", { title: "RSS Feed" }) # =>
|
444
|
+
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://www.example.com/feed.rss" />
|
471
445
|
```
|
472
446
|
|
473
447
|
#### image_path
|
@@ -1136,14 +1110,6 @@ If `@article.author_ids` is [1], this would return:
|
|
1136
1110
|
<input name="article[author_ids][]" type="hidden" value="" />
|
1137
1111
|
```
|
1138
1112
|
|
1139
|
-
#### country_options_for_select
|
1140
|
-
|
1141
|
-
Returns a string of option tags for pretty much any country in the world.
|
1142
|
-
|
1143
|
-
#### country_select
|
1144
|
-
|
1145
|
-
Returns select and option tags for the given object and method, using country_options_for_select to generate the list of option tags.
|
1146
|
-
|
1147
1113
|
#### option_groups_from_collection_for_select
|
1148
1114
|
|
1149
1115
|
Returns a string of `option` tags, like `options_from_collection_for_select`, but groups them by `optgroup` tags based on the object relationships of the arguments.
|
@@ -1420,22 +1386,6 @@ date_field_tag "dob"
|
|
1420
1386
|
|
1421
1387
|
Provides functionality for working with JavaScript in your views.
|
1422
1388
|
|
1423
|
-
#### button_to_function
|
1424
|
-
|
1425
|
-
Returns a button that'll trigger a JavaScript function using the onclick handler. Examples:
|
1426
|
-
|
1427
|
-
```ruby
|
1428
|
-
button_to_function "Greeting", "alert('Hello world!')"
|
1429
|
-
button_to_function "Delete", "if (confirm('Really?')) do_delete()"
|
1430
|
-
button_to_function "Details" do |page|
|
1431
|
-
page[:details].visual_effect :toggle_slide
|
1432
|
-
end
|
1433
|
-
```
|
1434
|
-
|
1435
|
-
#### define_javascript_functions
|
1436
|
-
|
1437
|
-
Includes the Action Pack JavaScript libraries inside a single `script` tag.
|
1438
|
-
|
1439
1389
|
#### escape_javascript
|
1440
1390
|
|
1441
1391
|
Escape carrier returns and single and double quotes for JavaScript segments.
|
@@ -1456,15 +1406,6 @@ alert('All is good')
|
|
1456
1406
|
</script>
|
1457
1407
|
```
|
1458
1408
|
|
1459
|
-
#### link_to_function
|
1460
|
-
|
1461
|
-
Returns a link that will trigger a JavaScript function using the onclick handler and return false after the fact.
|
1462
|
-
|
1463
|
-
```ruby
|
1464
|
-
link_to_function "Greeting", "alert('Hello world!')"
|
1465
|
-
# => <a onclick="alert('Hello world!'); return false;" href="#">Greeting</a>
|
1466
|
-
```
|
1467
|
-
|
1468
1409
|
### NumberHelper
|
1469
1410
|
|
1470
1411
|
Provides methods for converting numbers into formatted strings. Methods are provided for phone numbers, currency, percentage, precision, positional notation, and file size.
|