rails 4.2.0.beta1 → 4.2.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/guides/rails_guides/markdown.rb +6 -1
- data/guides/source/2_2_release_notes.md +1 -1
- data/guides/source/2_3_release_notes.md +1 -1
- data/guides/source/3_0_release_notes.md +2 -2
- data/guides/source/3_1_release_notes.md +4 -1
- data/guides/source/3_2_release_notes.md +4 -1
- data/guides/source/4_0_release_notes.md +4 -1
- data/guides/source/4_1_release_notes.md +4 -4
- data/guides/source/4_2_release_notes.md +272 -45
- data/guides/source/action_controller_overview.md +3 -3
- data/guides/source/action_mailer_basics.md +28 -4
- data/guides/source/action_view_overview.md +11 -11
- data/guides/source/active_job_basics.md +99 -63
- data/guides/source/active_record_postgresql.md +2 -1
- data/guides/source/active_record_querying.md +7 -9
- data/guides/source/active_support_core_extensions.md +48 -2
- data/guides/source/asset_pipeline.md +200 -18
- data/guides/source/association_basics.md +8 -8
- data/guides/source/caching_with_rails.md +1 -1
- data/guides/source/command_line.md +1 -1
- data/guides/source/configuring.md +7 -7
- data/guides/source/contributing_to_ruby_on_rails.md +17 -0
- data/guides/source/debugging_rails_applications.md +2 -2
- data/guides/source/development_dependencies_install.md +41 -43
- data/guides/source/form_helpers.md +17 -17
- data/guides/source/generators.md +6 -2
- data/guides/source/getting_started.md +1 -1
- data/guides/source/i18n.md +16 -0
- data/guides/source/initialization.md +0 -2
- data/guides/source/layouts_and_rendering.md +2 -1
- data/guides/source/maintenance_policy.md +6 -3
- data/guides/source/nested_model_forms.md +4 -1
- data/guides/source/routing.md +1 -1
- data/guides/source/testing.md +2 -2
- data/guides/source/upgrading_ruby_on_rails.md +94 -23
- metadata +18 -18
@@ -162,7 +162,7 @@ Active Support provides `duplicable?` to programmatically query an object about
|
|
162
162
|
false.duplicable? # => false
|
163
163
|
```
|
164
164
|
|
165
|
-
By definition all objects are `duplicable?` except `nil`, `false`, `true`, symbols, numbers, class, and
|
165
|
+
By definition all objects are `duplicable?` except `nil`, `false`, `true`, symbols, numbers, class, module, and method objects.
|
166
166
|
|
167
167
|
WARNING: Any class can disallow duplication by removing `dup` and `clone` or raising exceptions from them. Thus only `rescue` can tell whether a given arbitrary object is duplicable. `duplicable?` depends on the hard-coded list above, but it is much faster than `rescue`. Use it only if you know the hard-coded list is enough in your use case.
|
168
168
|
|
@@ -1268,7 +1268,7 @@ The method `squish` strips leading and trailing whitespace, and substitutes runs
|
|
1268
1268
|
|
1269
1269
|
There's also the destructive version `String#squish!`.
|
1270
1270
|
|
1271
|
-
Note that it handles both ASCII and Unicode whitespace
|
1271
|
+
Note that it handles both ASCII and Unicode whitespace.
|
1272
1272
|
|
1273
1273
|
NOTE: Defined in `active_support/core_ext/string/filters.rb`.
|
1274
1274
|
|
@@ -1310,6 +1310,38 @@ In above examples "dear" gets cut first, but then `:separator` prevents it.
|
|
1310
1310
|
|
1311
1311
|
NOTE: Defined in `active_support/core_ext/string/filters.rb`.
|
1312
1312
|
|
1313
|
+
### `truncate_words`
|
1314
|
+
|
1315
|
+
The method `truncate_words` returns a copy of its receiver truncated after a given number of words:
|
1316
|
+
|
1317
|
+
```ruby
|
1318
|
+
"Oh dear! Oh dear! I shall be late!".truncate_words(4)
|
1319
|
+
# => "Oh dear! Oh dear!..."
|
1320
|
+
```
|
1321
|
+
|
1322
|
+
Ellipsis can be customized with the `:omission` option:
|
1323
|
+
|
1324
|
+
```ruby
|
1325
|
+
"Oh dear! Oh dear! I shall be late!".truncate_words(4, omission: '…')
|
1326
|
+
# => "Oh dear! Oh dear!…"
|
1327
|
+
```
|
1328
|
+
|
1329
|
+
Pass a `:separator` to truncate the string at a natural break:
|
1330
|
+
|
1331
|
+
```ruby
|
1332
|
+
"Oh dear! Oh dear! I shall be late!".truncate_words(3, separator: '!')
|
1333
|
+
# => "Oh dear! Oh dear! I shall be late..."
|
1334
|
+
```
|
1335
|
+
|
1336
|
+
The option `:separator` can be a regexp:
|
1337
|
+
|
1338
|
+
```ruby
|
1339
|
+
"Oh dear! Oh dear! I shall be late!".truncate_words(4, separator: /\s/)
|
1340
|
+
# => "Oh dear! Oh dear!..."
|
1341
|
+
```
|
1342
|
+
|
1343
|
+
NOTE: Defined in `active_support/core_ext/string/filters.rb`.
|
1344
|
+
|
1313
1345
|
### `inquiry`
|
1314
1346
|
|
1315
1347
|
The `inquiry` method converts a string into a `StringInquirer` object making equality checks prettier.
|
@@ -2862,6 +2894,20 @@ Active Record does not accept unknown options when building associations, for ex
|
|
2862
2894
|
|
2863
2895
|
NOTE: Defined in `active_support/core_ext/hash/keys.rb`.
|
2864
2896
|
|
2897
|
+
### Working with Values
|
2898
|
+
|
2899
|
+
#### `transform_values` && `transform_values!`
|
2900
|
+
|
2901
|
+
The method `transform_values` accepts a block and returns a hash that has applied the block operations to each of the values in the receiver.
|
2902
|
+
|
2903
|
+
```ruby
|
2904
|
+
{ nil => nil, 1 => 1, :x => :a }.transform_values { |value| value.to_s.upcase }
|
2905
|
+
# => {nil=>"", 1=>"1", :x=>"A"}
|
2906
|
+
```
|
2907
|
+
There's also the bang variant `transform_values!` that applies the block operations to values in the very receiver.
|
2908
|
+
|
2909
|
+
NOTE: Defined in `active_support/core_text/hash/transform_values.rb`.
|
2910
|
+
|
2865
2911
|
### Slicing
|
2866
2912
|
|
2867
2913
|
Ruby has built-in support for taking slices out of strings and arrays. Active Support extends slicing to hashes:
|
@@ -166,7 +166,8 @@ pipeline, the preferred location for these assets is now the `app/assets`
|
|
166
166
|
directory. Files in this directory are served by the Sprockets middleware.
|
167
167
|
|
168
168
|
Assets can still be placed in the `public` hierarchy. Any assets under `public`
|
169
|
-
will be served as static files by the application or web server
|
169
|
+
will be served as static files by the application or web server when
|
170
|
+
`config.serve_static_assets` is set to true. You should use
|
170
171
|
`app/assets` for files that must undergo some pre-processing before they are
|
171
172
|
served.
|
172
173
|
|
@@ -207,9 +208,7 @@ precompiling works.
|
|
207
208
|
|
208
209
|
NOTE: You must have an ExecJS supported runtime in order to use CoffeeScript.
|
209
210
|
If you are using Mac OS X or Windows, you have a JavaScript runtime installed in
|
210
|
-
your operating system. Check
|
211
|
-
[ExecJS](https://github.com/sstephenson/execjs#readme) documentation to know all
|
212
|
-
supported JavaScript runtimes.
|
211
|
+
your operating system. Check [ExecJS](https://github.com/sstephenson/execjs#readme) documentation to know all supported JavaScript runtimes.
|
213
212
|
|
214
213
|
You can also disable generation of controller specific asset files by adding the
|
215
214
|
following to your `config/application.rb` configuration:
|
@@ -736,10 +735,10 @@ Rails.application.config.assets.precompile << Proc.new do |path|
|
|
736
735
|
full_path = Rails.application.assets.resolve(path).to_path
|
737
736
|
app_assets_path = Rails.root.join('app', 'assets').to_path
|
738
737
|
if full_path.starts_with? app_assets_path
|
739
|
-
|
738
|
+
logger.info "including asset: " + full_path
|
740
739
|
true
|
741
740
|
else
|
742
|
-
|
741
|
+
logger.info "excluding asset: " + full_path
|
743
742
|
false
|
744
743
|
end
|
745
744
|
else
|
@@ -916,24 +915,207 @@ end
|
|
916
915
|
|
917
916
|
### CDNs
|
918
917
|
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
918
|
+
CDN stands for [Content Delivery
|
919
|
+
Network](http://en.wikipedia.org/wiki/Content_delivery_network), they are
|
920
|
+
primarily designed to cache assets all over the world so that when a browser
|
921
|
+
requests the asset, a cached copy will be geographically close to that browser.
|
922
|
+
If you are serving assets directly from your Rails server in production, the
|
923
|
+
best practice is to use a CDN in front of your application.
|
924
|
+
|
925
|
+
A common pattern for using a CDN is to set your production application as the
|
926
|
+
"origin" server. This means when a browser requests an asset from the CDN and
|
927
|
+
there is a cache miss, it will grab the file from your server on the fly and
|
928
|
+
then cache it. For example if you are running a Rails application on
|
929
|
+
`example.com` and have a CDN configured at `mycdnsubdomain.fictional-cdn.com`,
|
930
|
+
then when a request is made to `mycdnsubdomain.fictional-
|
931
|
+
cdn.com/assets/smile.png`, the CDN will query your server once at
|
932
|
+
`example.com/assets/smile.png` and cache the request. The next request to the
|
933
|
+
CDN that comes in to the same URL will hit the cached copy. When the CDN can
|
934
|
+
serve an asset directly the request never touches your Rails server. Since the
|
935
|
+
assets from a CDN are geographically closer to the browser, the request is
|
936
|
+
faster, and since your server doesn't need to spend time serving assets, it can
|
937
|
+
focus on serving application code as fast as possible.
|
938
|
+
|
939
|
+
#### Set up a CDN to Serve Static Assets
|
940
|
+
|
941
|
+
To set up your CDN you have to have your application running in production on
|
942
|
+
the internet at a publically available URL, for example `example.com`. Next
|
943
|
+
you'll need to sign up for a CDN service from a cloud hosting provider. When you
|
944
|
+
do this you need to configure the "origin" of the CDN to point back at your
|
945
|
+
website `example.com`, check your provider for documentation on configuring the
|
946
|
+
origin server.
|
947
|
+
|
948
|
+
The CDN you provisioned should give you a custom subdomain for your application
|
949
|
+
such as `mycdnsubdomain.fictional-cdn.com` (note fictional-cdn.com is not a
|
950
|
+
valid CDN provider at the time of this writing). Now that you have configured
|
951
|
+
your CDN server, you need to tell browsers to use your CDN to grab assets
|
952
|
+
instead of your Rails server directly. You can do this by configuring Rails to
|
953
|
+
set your CDN as the asset host instead of using a relative path. To set your
|
954
|
+
asset host in Rails, you need to set `config.action_controller.asset_host` in
|
955
|
+
`config/production.rb`:
|
923
956
|
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
957
|
+
```ruby
|
958
|
+
config.action_controller.asset_host = 'mycdnsubdomain.fictional-cdn.com'
|
959
|
+
```
|
960
|
+
|
961
|
+
NOTE: You only need to provide the "host", this is the subdomain and root
|
962
|
+
domain, you do not need to specify a protocol or "scheme" such as `http://` or
|
963
|
+
`https://`. When a web page is requested, the protocol in the link to your asset
|
964
|
+
that is generated will match how the webpage is accessed by default.
|
965
|
+
|
966
|
+
You can also set this value through an [environment
|
967
|
+
variable](http://en.wikipedia.org/wiki/Environment_variable) to make running a
|
968
|
+
staging copy of your site easier:
|
969
|
+
|
970
|
+
```
|
971
|
+
config.action_controller.asset_host = ENV['CDN_HOST']
|
972
|
+
```
|
973
|
+
|
974
|
+
|
975
|
+
|
976
|
+
Note: You would need to set `CDN_HOST` on your server to `mycdnsubdomain
|
977
|
+
.fictional-cdn.com` for this to work.
|
978
|
+
|
979
|
+
Once you have configured your server and your CDN when you serve a webpage that
|
980
|
+
has an asset:
|
981
|
+
|
982
|
+
```erb
|
983
|
+
<%= asset_path('smile.png') %>
|
984
|
+
```
|
985
|
+
|
986
|
+
Instead of returning a path such as `/assets/smile.png` (digests are left out
|
987
|
+
for readability). The URL generated will have the full path to your CDN.
|
928
988
|
|
929
|
-
|
930
|
-
|
989
|
+
```
|
990
|
+
http://mycdnsubdomain.fictional-cdn.com/assets/smile.png
|
991
|
+
```
|
992
|
+
|
993
|
+
If the CDN has a copy of `smile.png` it will serve it to the browser and your
|
994
|
+
server doesn't even know it was requested. If the CDN does not have a copy it
|
995
|
+
will try to find it a the "origin" `example.com/assets/smile.png` and then store
|
996
|
+
it for future use.
|
997
|
+
|
998
|
+
If you want to serve only some assets from your CDN, you can use custom `:host`
|
999
|
+
option your asset helper, which overwrites value set in
|
931
1000
|
`config.action_controller.asset_host`.
|
932
1001
|
|
933
|
-
```
|
934
|
-
|
1002
|
+
```erb
|
1003
|
+
<%= asset_path 'image.png', host: 'mycdnsubdomain.fictional-cdn.com' %>
|
935
1004
|
```
|
936
1005
|
|
1006
|
+
#### Customize CDN Caching Behavior
|
1007
|
+
|
1008
|
+
A CDN works by caching content. If the CDN has stale or bad content, then it is
|
1009
|
+
hurting rather than helping your application. The purpose of this section is to
|
1010
|
+
describe general caching behavior of most CDNs, your specific provider may
|
1011
|
+
behave slightly differently.
|
1012
|
+
|
1013
|
+
##### CDN Request Caching
|
1014
|
+
|
1015
|
+
While a CDN is described as being good for caching assets, in reality caches the
|
1016
|
+
entire request. This includes the body of the asset as well as any headers. The
|
1017
|
+
most important one being `Cache-Control` which tells the CDN (and web browsers)
|
1018
|
+
how to cache contents. This means that if someone requests an asset that does
|
1019
|
+
not exist `/assets/i-dont-exist.png` and your Rails application returns a 404,
|
1020
|
+
then your CDN will likely cache the 404 page if a valid `Cache-Control` header
|
1021
|
+
is present.
|
1022
|
+
|
1023
|
+
##### CDN Header Debugging
|
1024
|
+
|
1025
|
+
One way to check the headers are cached properly in your CDN is by using [curl](
|
1026
|
+
http://explainshell.com/explain?cmd=curl+-I+http%3A%2F%2Fwww.example.com). You
|
1027
|
+
can request the headers from both your server and your CDN to verify they are
|
1028
|
+
the same:
|
1029
|
+
|
1030
|
+
```
|
1031
|
+
$ curl -I http://www.example/assets/application-
|
1032
|
+
d0e099e021c95eb0de3615fd1d8c4d83.css
|
1033
|
+
HTTP/1.1 200 OK
|
1034
|
+
Server: Cowboy
|
1035
|
+
Date: Sun, 24 Aug 2014 20:27:50 GMT
|
1036
|
+
Connection: keep-alive
|
1037
|
+
Last-Modified: Thu, 08 May 2014 01:24:14 GMT
|
1038
|
+
Content-Type: text/css
|
1039
|
+
Cache-Control: public, max-age=2592000
|
1040
|
+
Content-Length: 126560
|
1041
|
+
Via: 1.1 vegur
|
1042
|
+
```
|
1043
|
+
|
1044
|
+
Versus the CDN copy.
|
1045
|
+
|
1046
|
+
```
|
1047
|
+
$ curl -I http://mycdnsubdomain.fictional-cdn.com/application-
|
1048
|
+
d0e099e021c95eb0de3615fd1d8c4d83.css
|
1049
|
+
HTTP/1.1 200 OK Server: Cowboy Last-
|
1050
|
+
Modified: Thu, 08 May 2014 01:24:14 GMT Content-Type: text/css
|
1051
|
+
Cache-Control:
|
1052
|
+
public, max-age=2592000
|
1053
|
+
Via: 1.1 vegur
|
1054
|
+
Content-Length: 126560
|
1055
|
+
Accept-Ranges:
|
1056
|
+
bytes
|
1057
|
+
Date: Sun, 24 Aug 2014 20:28:45 GMT
|
1058
|
+
Via: 1.1 varnish
|
1059
|
+
Age: 885814
|
1060
|
+
Connection: keep-alive
|
1061
|
+
X-Served-By: cache-dfw1828-DFW
|
1062
|
+
X-Cache: HIT
|
1063
|
+
X-Cache-Hits:
|
1064
|
+
68
|
1065
|
+
X-Timer: S1408912125.211638212,VS0,VE0
|
1066
|
+
```
|
1067
|
+
|
1068
|
+
Check your CDN documentation for any additional information they may provide
|
1069
|
+
such as `X-Cache` or for any additional headers they may add.
|
1070
|
+
|
1071
|
+
##### CDNs and the Cache-Control Header
|
1072
|
+
|
1073
|
+
The [cache control
|
1074
|
+
header](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9) is a W3C
|
1075
|
+
specification that describes how a request can be cached. When no CDN is used, a
|
1076
|
+
browser will use this information to cache contents. This is very helpful for
|
1077
|
+
assets that are not modified so that a browser does not need to re-download a
|
1078
|
+
website's CSS or javascript on every request. Generally we want our Rails server
|
1079
|
+
to tell our CDN (and browser) that the asset is "public", that means any cache
|
1080
|
+
can store the request. Also we commonly want to set `max-age` which is how long
|
1081
|
+
the cache will store the object before invalidating the cache. The `max-age`
|
1082
|
+
value is set to seconds with a maximum possible value of `31536000` which is one
|
1083
|
+
year. You can do this in your rails application by setting
|
1084
|
+
|
1085
|
+
```
|
1086
|
+
config.static_cache_control = "public, max-age=31536000"
|
1087
|
+
```
|
1088
|
+
|
1089
|
+
Now when your application serves an asset in production, the CDN will store the
|
1090
|
+
asset for up to a year. Since most CDNs also cache headers of the request, this
|
1091
|
+
`Cache-Control` will be passed along to all future browsers seeking this asset,
|
1092
|
+
the browser then knows that it can store this asset for a very long time before
|
1093
|
+
needing to re-request it.
|
1094
|
+
|
1095
|
+
##### CDNs and URL based Cache Invalidation
|
1096
|
+
|
1097
|
+
Most CDNs will cache contents of an asset based on the complete URL. This means
|
1098
|
+
that a request to
|
1099
|
+
|
1100
|
+
```
|
1101
|
+
http://mycdnsubdomain.fictional-cdn.com/assets/smile-123.png
|
1102
|
+
```
|
1103
|
+
|
1104
|
+
Will be a completely different cache from
|
1105
|
+
|
1106
|
+
```
|
1107
|
+
http://mycdnsubdomain.fictional-cdn.com/assets/smile.png
|
1108
|
+
```
|
1109
|
+
|
1110
|
+
If you want to set far future `max-age` in your `Cache-Control` (and you do),
|
1111
|
+
then make sure when you change your assets that your cache is invalidated. For
|
1112
|
+
example when changing the smiley face in an image from yellow to blue, you want
|
1113
|
+
all visitors of your site to get the new blue face. When using a CDN with the
|
1114
|
+
Rails asset pipeline `config.assets.digest` is set to true by default so that
|
1115
|
+
each asset will have a different file name when it is changed. This way you
|
1116
|
+
don't have to ever manually invalidate any items in your cache. By using a
|
1117
|
+
different unique asset name instead, your users get the latest asset.
|
1118
|
+
|
937
1119
|
Customizing the Pipeline
|
938
1120
|
------------------------
|
939
1121
|
|
@@ -1321,9 +1321,9 @@ When you declare a `has_many` association, the declaring class automatically gai
|
|
1321
1321
|
* `collection<<(object, ...)`
|
1322
1322
|
* `collection.delete(object, ...)`
|
1323
1323
|
* `collection.destroy(object, ...)`
|
1324
|
-
* `collection=objects`
|
1324
|
+
* `collection=(objects)`
|
1325
1325
|
* `collection_singular_ids`
|
1326
|
-
* `collection_singular_ids=ids`
|
1326
|
+
* `collection_singular_ids=(ids)`
|
1327
1327
|
* `collection.clear`
|
1328
1328
|
* `collection.empty?`
|
1329
1329
|
* `collection.size`
|
@@ -1399,7 +1399,7 @@ The `collection.destroy` method removes one or more objects from the collection
|
|
1399
1399
|
|
1400
1400
|
WARNING: Objects will _always_ be removed from the database, ignoring the `:dependent` option.
|
1401
1401
|
|
1402
|
-
##### `collection=objects`
|
1402
|
+
##### `collection=(objects)`
|
1403
1403
|
|
1404
1404
|
The `collection=` method makes the collection contain only the supplied objects, by adding and deleting as appropriate.
|
1405
1405
|
|
@@ -1411,7 +1411,7 @@ The `collection_singular_ids` method returns an array of the ids of the objects
|
|
1411
1411
|
@order_ids = @customer.order_ids
|
1412
1412
|
```
|
1413
1413
|
|
1414
|
-
##### `collection_singular_ids=ids`
|
1414
|
+
##### `collection_singular_ids=(ids)`
|
1415
1415
|
|
1416
1416
|
The `collection_singular_ids=` method makes the collection contain only the objects identified by the supplied primary key values, by adding and deleting as appropriate.
|
1417
1417
|
|
@@ -1810,9 +1810,9 @@ When you declare a `has_and_belongs_to_many` association, the declaring class au
|
|
1810
1810
|
* `collection<<(object, ...)`
|
1811
1811
|
* `collection.delete(object, ...)`
|
1812
1812
|
* `collection.destroy(object, ...)`
|
1813
|
-
* `collection=objects`
|
1813
|
+
* `collection=(objects)`
|
1814
1814
|
* `collection_singular_ids`
|
1815
|
-
* `collection_singular_ids=ids`
|
1815
|
+
* `collection_singular_ids=(ids)`
|
1816
1816
|
* `collection.clear`
|
1817
1817
|
* `collection.empty?`
|
1818
1818
|
* `collection.size`
|
@@ -1895,7 +1895,7 @@ The `collection.destroy` method removes one or more objects from the collection
|
|
1895
1895
|
@part.assemblies.destroy(@assembly1)
|
1896
1896
|
```
|
1897
1897
|
|
1898
|
-
##### `collection=objects`
|
1898
|
+
##### `collection=(objects)`
|
1899
1899
|
|
1900
1900
|
The `collection=` method makes the collection contain only the supplied objects, by adding and deleting as appropriate.
|
1901
1901
|
|
@@ -1907,7 +1907,7 @@ The `collection_singular_ids` method returns an array of the ids of the objects
|
|
1907
1907
|
@assembly_ids = @part.assembly_ids
|
1908
1908
|
```
|
1909
1909
|
|
1910
|
-
##### `collection_singular_ids=ids`
|
1910
|
+
##### `collection_singular_ids=(ids)`
|
1911
1911
|
|
1912
1912
|
The `collection_singular_ids=` method makes the collection contain only the objects identified by the supplied primary key values, by adding and deleting as appropriate.
|
1913
1913
|
|
@@ -363,7 +363,7 @@ class ProductsController < ApplicationController
|
|
363
363
|
end
|
364
364
|
```
|
365
365
|
|
366
|
-
If you don't have any special response processing and are using the default rendering mechanism (i.e. you're not using respond_to or calling render yourself) then you've got an easy helper in fresh_when
|
366
|
+
If you don't have any special response processing and are using the default rendering mechanism (i.e. you're not using `respond_to` or calling render yourself) then you've got an easy helper in `fresh_when`:
|
367
367
|
|
368
368
|
```ruby
|
369
369
|
class ProductsController < ApplicationController
|
@@ -130,7 +130,7 @@ Example:
|
|
130
130
|
`rails generate controller CreditCards open debit credit close`
|
131
131
|
|
132
132
|
Credit card controller with URLs like /credit_cards/debit.
|
133
|
-
Controller: app/controllers/
|
133
|
+
Controller: app/controllers/credit_cards_controller.rb
|
134
134
|
Test: test/controllers/credit_cards_controller_test.rb
|
135
135
|
Views: app/views/credit_cards/debit.html.erb [...]
|
136
136
|
Helper: app/helpers/credit_cards_helper.rb
|
@@ -62,7 +62,7 @@ These configuration methods are to be called on a `Rails::Railtie` object, such
|
|
62
62
|
|
63
63
|
* `config.autoload_paths` accepts an array of paths from which Rails will autoload constants. Default is all directories under `app`.
|
64
64
|
|
65
|
-
* `config.cache_classes` controls whether or not application classes and modules should be reloaded on each request. Defaults to false in development mode, and true in test and production modes.
|
65
|
+
* `config.cache_classes` controls whether or not application classes and modules should be reloaded on each request. Defaults to false in development mode, and true in test and production modes.
|
66
66
|
|
67
67
|
* `config.action_view.cache_template_loading` controls whether or not templates should be reloaded on each request. Defaults to whatever is set for `config.cache_classes`.
|
68
68
|
|
@@ -86,7 +86,7 @@ application. Accepts a valid week day symbol (e.g. `:monday`).
|
|
86
86
|
end
|
87
87
|
```
|
88
88
|
|
89
|
-
* `config.dependency_loading` is a flag that allows you to disable constant autoloading setting it to false. It only has effect if `config.cache_classes` is true, which it is by default in production mode.
|
89
|
+
* `config.dependency_loading` is a flag that allows you to disable constant autoloading setting it to false. It only has effect if `config.cache_classes` is true, which it is by default in production mode.
|
90
90
|
|
91
91
|
* `config.eager_load` when true, eager loads all registered `config.eager_load_namespaces`. This includes your application, engines, Rails frameworks and any other registered namespace.
|
92
92
|
|
@@ -108,11 +108,11 @@ numbers. New applications filter out passwords by adding the following `config.f
|
|
108
108
|
|
109
109
|
* `config.log_formatter` defines the formatter of the Rails logger. This option defaults to an instance of `ActiveSupport::Logger::SimpleFormatter` for all modes except production, where it defaults to `Logger::Formatter`.
|
110
110
|
|
111
|
-
* `config.log_level` defines the verbosity of the Rails logger. This option defaults to `:debug` for all
|
111
|
+
* `config.log_level` defines the verbosity of the Rails logger. This option defaults to `:debug` for all environments.
|
112
112
|
|
113
113
|
* `config.log_tags` accepts a list of methods that the `request` object responds to. This makes it easy to tag log lines with debug information like subdomain and request id - both very helpful in debugging multi-user production applications.
|
114
114
|
|
115
|
-
* `config.logger` accepts a logger conforming to the interface of Log4r or the default Ruby `Logger` class. Defaults to an instance of `ActiveSupport::Logger
|
115
|
+
* `config.logger` accepts a logger conforming to the interface of Log4r or the default Ruby `Logger` class. Defaults to an instance of `ActiveSupport::Logger`.
|
116
116
|
|
117
117
|
* `config.middleware` allows you to configure the application's middleware. This is covered in depth in the [Configuring Middleware](#configuring-middleware) section below.
|
118
118
|
|
@@ -137,7 +137,7 @@ numbers. New applications filter out passwords by adding the following `config.f
|
|
137
137
|
* `config.assets.enabled` a flag that controls whether the asset
|
138
138
|
pipeline is enabled. It is set to true by default.
|
139
139
|
|
140
|
-
* `config.assets.raise_runtime_errors
|
140
|
+
* `config.assets.raise_runtime_errors` Set this flag to `true` to enable additional runtime error checking. Recommended in `config/environments/development.rb` to minimize unexpected behavior when deploying to `production`.
|
141
141
|
|
142
142
|
* `config.assets.compress` a flag that enables the compression of compiled assets. It is explicitly set to true in `config/environments/production.rb`.
|
143
143
|
|
@@ -290,8 +290,6 @@ All these configuration options are delegated to the `I18n` library.
|
|
290
290
|
|
291
291
|
* `config.active_record.partial_writes` is a boolean value and controls whether or not partial writes are used (i.e. whether updates only set attributes that are dirty). Note that when using partial writes, you should also use optimistic locking `config.active_record.lock_optimistically` since concurrent updates may write attributes based on a possibly stale read state. The default value is `true`.
|
292
292
|
|
293
|
-
* `config.active_record.attribute_types_cached_by_default` sets the attribute types that `ActiveRecord::AttributeMethods` will cache by default on reads. The default is `[:datetime, :timestamp, :time, :date]`.
|
294
|
-
|
295
293
|
* `config.active_record.maintain_test_schema` is a boolean value which controls whether Active Record should try to keep your test database schema up-to-date with `db/schema.rb` (or `db/structure.sql`) when you run your tests. The default is true.
|
296
294
|
|
297
295
|
* `config.active_record.dump_schema_after_migration` is a flag which
|
@@ -473,6 +471,8 @@ There are a few configuration options available in Active Support:
|
|
473
471
|
|
474
472
|
* `config.active_support.bare` enables or disables the loading of `active_support/all` when booting Rails. Defaults to `nil`, which means `active_support/all` is loaded.
|
475
473
|
|
474
|
+
* `config.active_support.test_order` sets the order that test cases are executed. Possible values are `:sorted` and `:random`. Currently defaults to `:sorted`. In Rails 5.0, the default will be changed to `:random` instead.
|
475
|
+
|
476
476
|
* `config.active_support.escape_html_entities_in_json` enables or disables the escaping of HTML entities in JSON serialization. Defaults to `false`.
|
477
477
|
|
478
478
|
* `config.active_support.use_standard_json_time_format` enables or disables serializing dates to ISO 8601 format. Defaults to `true`.
|