rails 4.2.0 → 4.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -685,7 +685,7 @@ you can safely pass the username as set by the user:
685
685
 
686
686
  ```erb
687
687
  <%# This is safe, it is going to be escaped if needed. %>
688
- <%= t('welcome_html', username: @current_user.username %>
688
+ <%= t('welcome_html', username: @current_user.username) %>
689
689
  ```
690
690
 
691
691
  Safe strings on the other hand are interpolated verbatim.
@@ -807,7 +807,7 @@ So, for example, instead of the default error message `"cannot be blank"` you co
807
807
 
808
808
  | validation | with option | message | interpolation |
809
809
  | ------------ | ------------------------- | ------------------------- | ------------- |
810
- | confirmation | - | :confirmation | - |
810
+ | confirmation | - | :confirmation | attribute |
811
811
  | acceptance | - | :accepted | - |
812
812
  | presence | - | :blank | - |
813
813
  | absence | - | :present | - |
@@ -827,6 +827,7 @@ So, for example, instead of the default error message `"cannot be blank"` you co
827
827
  | numericality | :equal_to | :equal_to | count |
828
828
  | numericality | :less_than | :less_than | count |
829
829
  | numericality | :less_than_or_equal_to | :less_than_or_equal_to | count |
830
+ | numericality | :other_than | :other_than | count |
830
831
  | numericality | :only_integer | :not_an_integer | - |
831
832
  | numericality | :odd | :odd | - |
832
833
  | numericality | :even | :even | - |
@@ -161,7 +161,7 @@ throwing an error message. If the command is valid, a method of the same name
161
161
  is called.
162
162
 
163
163
  ```ruby
164
- COMMAND_WHITELIST = %(plugin generate destroy console server dbconsole application runner new version help)
164
+ COMMAND_WHITELIST = %w(plugin generate destroy console server dbconsole application runner new version help)
165
165
 
166
166
  def run_command!(command)
167
167
  command = parse_command(command)
@@ -805,6 +805,18 @@ As long as `Sprockets` responds to `call` and returns a `[status, headers, body]
805
805
 
806
806
  NOTE: For the curious, `'articles#index'` actually expands out to `ArticlesController.action(:index)`, which returns a valid Rack application.
807
807
 
808
+ If you specify a rack application as the endpoint for a matcher remember that the route will be unchanged in the receiving application. With the following route your rack application should expect the route to be '/admin':
809
+
810
+ ```ruby
811
+ match '/admin', to: AdminApp, via: :all
812
+ ```
813
+
814
+ If you would prefer to have your rack application receive requests at the root path instead use mount:
815
+
816
+ ```ruby
817
+ mount AdminApp, at: '/admin'
818
+ ```
819
+
808
820
  ### Using `root`
809
821
 
810
822
  You can specify what Rails should route `'/'` to with the `root` method:
@@ -221,7 +221,16 @@ Every test contains one or more assertions. Only when all the assertions are suc
221
221
 
222
222
  ### Maintaining the test database schema
223
223
 
224
- In order to run your tests, your test database will need to have the current structure. The test helper checks whether your test database has any pending migrations. If so, it will try to load your `db/schema.rb` or `db/structure.sql` into the test database. If migrations are still pending, an error will be raised.
224
+ In order to run your tests, your test database will need to have the current
225
+ structure. The test helper checks whether your test database has any pending
226
+ migrations. If so, it will try to load your `db/schema.rb` or `db/structure.sql`
227
+ into the test database. If migrations are still pending, an error will be
228
+ raised. Usually this indicates that your schema is not fully migrated. Running
229
+ the migrations against the development database (`bin/rake db:migrate`) will
230
+ bring the schema up to date.
231
+
232
+ NOTE: If existing migrations required modifications, the test database needs to
233
+ be rebuilt. This can be done by executing `bin/rake db:test:prepare`.
225
234
 
226
235
  ### Running Tests
227
236
 
@@ -1100,7 +1109,7 @@ within a model:
1100
1109
  ```ruby
1101
1110
  require 'test_helper'
1102
1111
 
1103
- class ProductTest < ActiveSupport::TestCase
1112
+ class ProductTest < ActiveJob::TestCase
1104
1113
  test 'billing job scheduling' do
1105
1114
  assert_enqueued_with(job: BillingJob) do
1106
1115
  product.charge(account)
@@ -248,6 +248,22 @@ class Notifier < ActionMailer::Base
248
248
  end
249
249
  ```
250
250
 
251
+ ### Foreign Key Support
252
+
253
+ The migration DSL has been expanded to support foreign key definitions. If
254
+ you've been using the Foreigner gem, you might want to consider removing it.
255
+ Note that the foreign key support of Rails is a subset of Foreigner. This means
256
+ that not every Foreigner definition can be fully replaced by it's Rails
257
+ migration DSL counterpart.
258
+
259
+ The migration procedure is as follows:
260
+
261
+ 1. remove `gem "foreigner"` from the Gemfile.
262
+ 2. run `bundle install`.
263
+ 3. run `bin/rake db:schema:dump`.
264
+ 4. make sure that `db/schema.rb` contains every foreign key definition with
265
+ the necessary options.
266
+
251
267
  Upgrading from Rails 4.0 to Rails 4.1
252
268
  -------------------------------------
253
269
 
@@ -766,7 +782,7 @@ file (in `config/application.rb`):
766
782
  ```ruby
767
783
  # Require the gems listed in Gemfile, including any gems
768
784
  # you've limited to :test, :development, or :production.
769
- Bundler.require(:default, Rails.env)
785
+ Bundler.require(*Rails.groups)
770
786
  ```
771
787
 
772
788
  ### vendor/plugins
@@ -822,6 +838,20 @@ this gem such as `whitelist_attributes` or `mass_assignment_sanitizer` options.
822
838
 
823
839
  * To re-enable the old finders, you can use the [activerecord-deprecated_finders gem](https://github.com/rails/activerecord-deprecated_finders).
824
840
 
841
+ * Rails 4.0 has changed to default join table for `has_and_belongs_to_many` relations to strip the common prefix off the second table name. Any existing `has_and_belongs_to_many` relationship between models with a common prefix must be specified with the `join_table` option. For example:
842
+
843
+ ```ruby
844
+ CatalogCategory < ActiveRecord::Base
845
+ has_and_belongs_to_many :catalog_products, join_table: 'catalog_categories_catalog_products'
846
+ end
847
+
848
+ CatalogProduct < ActiveRecord::Base
849
+ has_and_belongs_to_many :catalog_categories, join_table: 'catalog_categories_catalog_products'
850
+ end
851
+ ```
852
+
853
+ * Note that the the prefix takes scopes into account as well, so relations between `Catalog::Category` and `Catalog::Product` or `Catalog::Category` and `CatalogProduct` need to be updated similarly.
854
+
825
855
  ### Active Resource
826
856
 
827
857
  Rails 4.0 extracted Active Resource to its own gem. If you still need the feature you can add the [Active Resource gem](https://github.com/rails/activeresource) in your Gemfile.
@@ -865,6 +895,8 @@ Please read [Pull Request #9978](https://github.com/rails/rails/pull/9978) for d
865
895
 
866
896
  * Rails 4.0 has removed the XML parameters parser. You will need to add the `actionpack-xml_parser` gem if you require this feature.
867
897
 
898
+ * Rails 4.0 changes the default `layout` lookup set using symbols or procs that return nil. To get the "no layout" behavior, return false instead of nil.
899
+
868
900
  * Rails 4.0 changes the default memcached client from `memcache-client` to `dalli`. To upgrade, simply add `gem 'dalli'` to your `Gemfile`.
869
901
 
870
902
  * Rails 4.0 deprecates the `dom_id` and `dom_class` methods in controllers (they are fine in views). You will need to include the `ActionView::RecordIdentifier` module in controllers requiring this feature.
@@ -1110,7 +1142,7 @@ You can help test performance with these additions to your test environment:
1110
1142
 
1111
1143
  ```ruby
1112
1144
  # Configure static asset server for tests with Cache-Control for performance
1113
- config.serve_static_assets = true
1145
+ config.serve_static_files = true
1114
1146
  config.static_cache_control = 'public, max-age=3600'
1115
1147
  ```
1116
1148
 
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.2.0
4
+ version: 4.2.3
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: 2014-12-20 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,112 +16,112 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0
19
+ version: 4.2.3
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.2.0
26
+ version: 4.2.3
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.2.0
33
+ version: 4.2.3
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.2.0
40
+ version: 4.2.3
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.2.0
47
+ version: 4.2.3
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.2.0
54
+ version: 4.2.3
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.2.0
61
+ version: 4.2.3
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.2.0
68
+ version: 4.2.3
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.2.0
75
+ version: 4.2.3
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.2.0
82
+ version: 4.2.3
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.2.0
89
+ version: 4.2.3
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.2.0
96
+ version: 4.2.3
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: activejob
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 4.2.0
103
+ version: 4.2.3
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 4.2.0
110
+ version: 4.2.3
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: railties
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 4.2.0
117
+ version: 4.2.3
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 4.2.0
124
+ version: 4.2.3
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bundler
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -308,6 +308,8 @@ files:
308
308
  - guides/bug_report_templates/action_controller_master.rb
309
309
  - guides/bug_report_templates/active_record_gem.rb
310
310
  - guides/bug_report_templates/active_record_master.rb
311
+ - guides/bug_report_templates/generic_gem.rb
312
+ - guides/bug_report_templates/generic_master.rb
311
313
  - guides/rails_guides.rb
312
314
  - guides/rails_guides/generator.rb
313
315
  - guides/rails_guides/helpers.rb
@@ -342,10 +344,10 @@ files:
342
344
  - guides/source/api_documentation_guidelines.md
343
345
  - guides/source/asset_pipeline.md
344
346
  - guides/source/association_basics.md
347
+ - guides/source/autoloading_and_reloading_constants.md
345
348
  - guides/source/caching_with_rails.md
346
349
  - guides/source/command_line.md
347
350
  - guides/source/configuring.md
348
- - guides/source/constant_autoloading_and_reloading.md
349
351
  - guides/source/contributing_to_ruby_on_rails.md
350
352
  - guides/source/credits.html.erb
351
353
  - guides/source/debugging_rails_applications.md
@@ -398,7 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
398
400
  version: 1.8.11
399
401
  requirements: []
400
402
  rubyforge_project:
401
- rubygems_version: 2.2.2
403
+ rubygems_version: 2.4.5
402
404
  signing_key:
403
405
  specification_version: 4
404
406
  summary: Full-stack web application framework.