Skip to content
This repository
Browse code

Update 4.0 Release Notes with changelogs [ci skip]

Also fix some wrong formatting.

Related discussion:
ab72040#commitcomment-1525256
  • Loading branch information...
commit 215d41d802637520129cb7551b35faca72873143 1 parent 65dc45e
Carlos Antonio da Silva authored July 01, 2012
6  actionpack/CHANGELOG.md
Source Rendered
@@ -14,9 +14,9 @@
14 14
 
15 15
 *   Return proper format on exceptions. *Santiago Pastorino*
16 16
 
17  
-*   Allow to use mounted_helpers (helpers for accessing mounted engines) in ActionView::TestCase. *Piotr Sarnacki*
  17
+*   Allow to use `mounted_helpers` (helpers for accessing mounted engines) in `ActionView::TestCase`. *Piotr Sarnacki*
18 18
 
19  
-*   Include mounted_helpers (helpers for accessing mounted engines) in ActionDispatch::IntegrationTest by default. *Piotr Sarnacki*
  19
+*   Include `mounted_helpers` (helpers for accessing mounted engines) in `ActionDispatch::IntegrationTest` by default. *Piotr Sarnacki*
20 20
 
21 21
 *   Extracted redirect logic from `ActionController::ForceSSL::ClassMethods.force_ssl`  into `ActionController::ForceSSL#force_ssl_redirect`
22 22
 
@@ -49,7 +49,7 @@
49 49
 
50 50
     *Piotr Sarnacki*
51 51
 
52  
-*   `truncate` now always returns an escaped HTMl-safe string. The option `:escape` can be used as
  52
+*   `truncate` now always returns an escaped HTML-safe string. The option `:escape` can be used as
53 53
     false to not escape the result.
54 54
 
55 55
     *Li Ellis Gallardo + Rafael Mendonça França*
6  activerecord/CHANGELOG.md
Source Rendered
@@ -47,7 +47,7 @@
47 47
 
48 48
     *Tony Schneider*
49 49
 
50  
-*   Allow ActiveRecord::Relation#pluck to accept multiple columns. Returns an
  50
+*   Allow `ActiveRecord::Relation#pluck` to accept multiple columns. Returns an
51 51
     array of arrays containing the typecasted values:
52 52
 
53 53
         Person.pluck(:id, :name)
@@ -88,7 +88,7 @@
88 88
 
89 89
     *Andrew White*
90 90
 
91  
-*   Move HABTM validity checks to ActiveRecord::Reflection. One side effect of
  91
+*   Move HABTM validity checks to `ActiveRecord::Reflection`. One side effect of
92 92
     this is to move when the exceptions are raised from the point of declaration
93 93
     to when the association is built. This is consistant with other association
94 94
     validity checks.
@@ -96,7 +96,7 @@
96 96
     *Andrew White*
97 97
 
98 98
 *   Added `stored_attributes` hash which contains the attributes stored using
99  
-    ActiveRecord::Store. This allows you to retrieve the list of attributes
  99
+    `ActiveRecord::Store`. This allows you to retrieve the list of attributes
100 100
     you've defined.
101 101
 
102 102
        class User < ActiveRecord::Base
6  activesupport/CHANGELOG.md
Source Rendered
... ...
@@ -1,10 +1,10 @@
1 1
 ## Rails 4.0.0 (unreleased) ##
2 2
 
3  
-*   Time#change now works with time values with offsets other than UTC or the local time zone. *Andrew White*
  3
+*   `Time#change` now works with time values with offsets other than UTC or the local time zone. *Andrew White*
4 4
 
5  
-*   AS::Callbacks: deprecate usage of filter object with `#before` and `#after` methods as `around` callback. *Bogdan Gusiev*
  5
+*   `ActiveSupport::Callbacks`: deprecate usage of filter object with `#before` and `#after` methods as `around` callback. *Bogdan Gusiev*
6 6
 
7  
-*   Add `Time#prev_quarter' and 'Time#next_quarter' short-hands for months_ago(3) and months_since(3). *SungHee Kang*
  7
+*   Add `Time#prev_quarter` and `Time#next_quarter` short-hands for `months_ago(3)` and `months_since(3)`. *SungHee Kang*
8 8
 
9 9
 *   Remove obsolete and unused `require_association` method from dependencies. *fxn*
10 10
 
235  guides/source/4_0_release_notes.textile
Source Rendered
@@ -64,6 +64,16 @@ h3. Documentation
64 64
 
65 65
 h3. Railties
66 66
 
  67
+* Allow scaffold/model/migration generators to accept a <tt>polymorphic</tt> modifier for <tt>references</tt>/<tt>belongs_to</tt>, for instance
  68
+
  69
+<shell>
  70
+rails g model Product supplier:references{polymorphic}
  71
+</shell>
  72
+
  73
+will generate the model with <tt>belongs_to :supplier, polymorphic: true</tt> association and appropriate migration.
  74
+
  75
+* Set <tt>config.active_record.migration_error</tt> to <tt>:page_load</tt> for development.
  76
+
67 77
 * Add runner to <tt>Rails::Railtie</tt> as a hook called just after runner starts.
68 78
 
69 79
 * Add <tt>/rails/info/routes</tt> path which displays the same information as +rake routes+.
@@ -102,12 +112,30 @@ h4(#railties_deprecations). Deprecations
102 112
 
103 113
 h3. Action Mailer
104 114
 
105  
-* No changes.
  115
+* Raise an <tt>ActionView::MissingTemplate</tt> exception when no implicit template could be found.
  116
+
  117
+* Asynchronously send messages via the Rails Queue.
106 118
 
107 119
 h3. Action Pack
108 120
 
109 121
 h4. Action Controller
110 122
 
  123
+* Remove Active Model dependency from Action Pack.
  124
+
  125
+* Support unicode characters in routes. Route will be automatically escaped, so instead of manually escaping:
  126
+
  127
+<ruby>
  128
+get Rack::Utils.escape('こんにちは') => 'home#index'
  129
+</ruby>
  130
+
  131
+You just have to write the unicode route:
  132
+
  133
+<ruby>
  134
+get 'こんにちは' => 'home#index'
  135
+</ruby>
  136
+
  137
+* Return proper format on exceptions.
  138
+
111 139
 * Extracted redirect logic from <tt>ActionController::ForceSSL::ClassMethods.force_ssl</tt>  into <tt>ActionController::ForceSSL#force_ssl_redirect</tt>.
112 140
 
113 141
 * URL path parameters with invalid encoding now raise <tt>ActionController::BadRequest</tt>.
@@ -156,6 +184,8 @@ h5(#actioncontroller_deprecations). Deprecations
156 184
 
157 185
 h4. Action Dispatch
158 186
 
  187
+* Include <tt>mounted_helpers</tt> (helpers for accessing mounted engines) in <tt>ActionDispatch::IntegrationTest</tt> by default.
  188
+
159 189
 * Added <tt>ActionDispatch::SSL</tt> middleware that when included force all the requests to be under HTTPS protocol.
160 190
 
161 191
 * Copy literal route constraints to defaults so that url generation know about them.  The copied constraints are <tt>:protocol</tt>, <tt>:subdomain</tt>, <tt>:domain</tt>, <tt>:host</tt> and <tt>:port</tt>.
@@ -179,12 +209,14 @@ If <tt>:patch</tt> is the default verb for updates, edits are tunneled as <tt>PA
179 209
 
180 210
 * Turn off verbose mode of <tt>rack-cache</tt>, we still have <tt>X-Rack-Cache</tt> to check that info.
181 211
 
182  
-* Include mounted_helpers (helpers for accessing mounted engines) in <tt>ActionDispatch::IntegrationTest</tt> by default.
183  
-
184 212
 h5(#actiondispatch_deprecations). Deprecations
185 213
 
186 214
 h4. Action View
187 215
 
  216
+* Remove Active Model dependency from Action Pack.
  217
+
  218
+* Allow to use <tt>mounted_helpers</tt> (helpers for accessing mounted engines) in <tt>ActionView::TestCase</tt>.
  219
+
188 220
 * Make current object and counter (when it applies) variables accessible when rendering templates with <tt>:object</tt> or <tt>:collection</tt>.
189 221
 
190 222
 * Allow to lazy load +default_form_builder+ by passing a string instead of a constant.
@@ -205,8 +237,6 @@ h4. Action View
205 237
 
206 238
 * Removed old +text_helper+ apis for +highlight+, +excerpt+ and +word_wrap+.
207 239
 
208  
-* Allow to use mounted_helpers (helpers for accessing mounted engines) in <tt>ActionView::TestCase</tt>.
209  
-
210 240
 * Remove the leading \n added by textarea on +assert_select+.
211 241
 
212 242
 * Changed default value for <tt>config.action_view.embed_authenticity_token_in_remote_forms</tt> to false. This change breaks remote forms that need to work also without JavaScript, so if you need such behavior, you can either set it to true or explicitly pass <tt>:authenticity_token => true</tt> in form options.
@@ -299,6 +329,127 @@ Moved into a separate gem <tt>sprockets-rails</tt>.
299 329
 
300 330
 h3. Active Record
301 331
 
  332
+* Add <tt>:default</tt> and <tt>:null</tt> options to <tt>column_exists?</tt>.
  333
+
  334
+<ruby>
  335
+column_exists?(:testings, :taggable_id, :integer, null: false)
  336
+column_exists?(:testings, :taggable_type, :string, default: 'Photo')
  337
+</ruby>
  338
+
  339
+* <tt>ActiveRelation#inspect</tt> no longer calls <tt>#to_a</tt>. This means that in places where <tt>#inspect</tt> is implied (such as in the console), creating a relation will not execute it anymore, you'll have to call <tt>#to_a</tt> when necessary:
  340
+
  341
+<ruby>
  342
+User.where(:age => 30)      # => returns the relation
  343
+User.where(:age => 30).to_a # => executes the query and returns the loaded objects, as before
  344
+</ruby>
  345
+
  346
+* Add <tt>collation</tt> and <tt>ctype</tt> support to PostgreSQL. These are available for PostgreSQL 8.4 or later.
  347
+
  348
+<yaml>
  349
+development:
  350
+  adapter: postgresql
  351
+  host: localhost
  352
+  database: rails_development
  353
+  username: foo
  354
+  password: bar
  355
+  encoding: UTF8
  356
+  collation: ja_JP.UTF8
  357
+  ctype: ja_JP.UTF8
  358
+</yaml>
  359
+
  360
+* <tt>FinderMethods#exists?</tt> now returns <tt>false</tt> with the <tt>false</tt> argument.
  361
+
  362
+* Added support for specifying the precision of a timestamp in the postgresql adapter. So, instead of having to incorrectly specify the precision using the <tt>:limit</tt> option, you may use <tt>:precision</tt>, as intended. For example, in a migration:
  363
+
  364
+<ruby>
  365
+def change
  366
+  create_table :foobars do |t|
  367
+    t.timestamps :precision => 0
  368
+  end
  369
+end
  370
+</ruby>
  371
+
  372
+* Allow <tt>ActiveRecord::Relation#pluck</tt> to accept multiple columns. Returns an array of arrays containing the typecasted values:
  373
+
  374
+<ruby>
  375
+Person.pluck(:id, :name)
  376
+# SELECT people.id, people.name FROM people
  377
+# => [[1, 'David'], [2, 'Jeremy'], [3, 'Jose']]
  378
+</ruby>
  379
+
  380
+* Improve the derivation of HABTM join table name to take account of nesting. It now takes the table names of the two models, sorts them lexically and then joins them, stripping any common prefix from the second table name. Some examples:
  381
+
  382
+<plain>
  383
+Top level models (Category <=> Product)
  384
+Old: categories_products
  385
+New: categories_products
  386
+
  387
+Top level models with a global table_name_prefix (Category <=> Product)
  388
+Old: site_categories_products
  389
+New: site_categories_products
  390
+
  391
+Nested models in a module without a table_name_prefix method (Admin::Category <=> Admin::Product)
  392
+Old: categories_products
  393
+New: categories_products
  394
+
  395
+Nested models in a module with a table_name_prefix method (Admin::Category <=> Admin::Product)
  396
+Old: categories_products
  397
+New: admin_categories_products
  398
+
  399
+Nested models in a parent model (Catalog::Category <=> Catalog::Product)
  400
+Old: categories_products
  401
+New: catalog_categories_products
  402
+
  403
+Nested models in different parent models (Catalog::Category <=> Content::Page)
  404
+Old: categories_pages
  405
+New: catalog_categories_content_pages
  406
+</plain>
  407
+
  408
+* Move HABTM validity checks to <tt>ActiveRecord::Reflection</tt>. One side effect of this is to move when the exceptions are raised from the point of declaration to when the association is built. This is consistant with other association validity checks.
  409
+
  410
+* Added <tt>stored_attributes</tt> hash which contains the attributes stored using <tt>ActiveRecord::Store</tt>. This allows you to retrieve the list of attributes you've defined.
  411
+
  412
+<ruby>
  413
+class User < ActiveRecord::Base
  414
+  store :settings, accessors: [:color, :homepage]
  415
+end
  416
+
  417
+User.stored_attributes[:settings] # [:color, :homepage]
  418
+</ruby>
  419
+
  420
+* <tt>composed_of</tt> was removed. You'll have to write your own accessor and mutator methods if you'd like to use value objects to represent some portion of your models. So, instead of:
  421
+
  422
+<ruby>
  423
+class Person < ActiveRecord::Base
  424
+  composed_of :address, :mapping => [ %w(address_street street), %w(address_city city) ]
  425
+end
  426
+</ruby>
  427
+
  428
+you could write something like this:
  429
+
  430
+<ruby>
  431
+def address
  432
+  @address ||= Address.new(address_street, address_city)
  433
+end
  434
+
  435
+def address=(address)
  436
+  self[:address_street] = @address.street
  437
+  self[:address_city]   = @address.city
  438
+
  439
+  @address = address
  440
+end
  441
+</ruby>
  442
+
  443
+* PostgreSQL default log level is now 'warning', to bypass the noisy notice messages. You can change the log level using the <tt>min_messages</tt> option available in your <tt>config/database.yml</tt>.
  444
+
  445
+* Add uuid datatype support to PostgreSQL adapter.
  446
+
  447
+* <tt>update_attribute</tt> has been removed. Use <tt>update_column</tt> if you want to bypass mass-assignment protection, validations, callbacks, and touching of updated_at. Otherwise please use <tt>update_attributes</tt>.
  448
+
  449
+* Added <tt>ActiveRecord::Migration.check_pending!</tt> that raises an error if migrations are pending.
  450
+
  451
+* Added <tt>#destroy!</tt> which acts like <tt>#destroy</tt> but will raise an <tt>ActiveRecord::RecordNotDestroyed</tt> exception instead of returning <tt>false</tt>.
  452
+
302 453
 * Allow blocks for count with <tt>ActiveRecord::Relation</tt>, to work similar as <tt>Array#count</tt>: <tt>Person.where("age > 26").count { |person| person.gender == 'female' }</tt>
303 454
 
304 455
 * Added support to <tt>CollectionAssociation#delete</tt> for passing fixnum or string values as record ids. This finds the records responding to the ids and deletes them.
@@ -475,27 +626,37 @@ The code to implement the deprecated features has been moved out to the +active_
475 626
 
476 627
   Don't use this:
477 628
 
478  
-      scope :red, where(color: 'red')
479  
-      default_scope where(color: 'red')
  629
+<ruby>
  630
+scope :red, where(color: 'red')
  631
+default_scope where(color: 'red')
  632
+</ruby>
480 633
 
481 634
   Use this:
482 635
 
483  
-      scope :red, -> { where(color: 'red') }
484  
-      default_scope { where(color: 'red') }
  636
+<ruby>
  637
+scope :red, -> { where(color: 'red') }
  638
+default_scope { where(color: 'red') }
  639
+</ruby>
485 640
 
486 641
   The former has numerous issues. It is a common newbie gotcha to do the following:
487 642
 
488  
-      scope :recent, where(published_at: Time.now - 2.weeks)
  643
+<ruby>
  644
+scope :recent, where(published_at: Time.now - 2.weeks)
  645
+</ruby>
489 646
 
490 647
   Or a more subtle variant:
491 648
 
492  
-      scope :recent, -> { where(published_at: Time.now - 2.weeks) }
493  
-      scope :recent_red, recent.where(color: 'red')
  649
+<ruby>
  650
+scope :recent, -> { where(published_at: Time.now - 2.weeks) }
  651
+scope :recent_red, recent.where(color: 'red')
  652
+</ruby>
494 653
 
495 654
   Eager scopes are also very complex to implement within Active Record, and there are still bugs. For example, the following does not do what you expect:
496 655
 
497  
-      scope :remove_conditions, except(:where)
498  
-      where(...).remove_conditions # => still has conditions
  656
+<ruby>
  657
+scope :remove_conditions, except(:where)
  658
+where(...).remove_conditions # => still has conditions
  659
+</ruby>
499 660
 
500 661
 * Added deprecation for the :dependent => :restrict association option.
501 662
 
@@ -507,6 +668,32 @@ The code to implement the deprecated features has been moved out to the +active_
507 668
 
508 669
 h3. Active Model
509 670
 
  671
+* Changed <tt>AM::Serializers::JSON.include_root_in_json</tt> default value to false. Now, AM Serializers and AR objects have the same default behaviour.
  672
+
  673
+<ruby>
  674
+class User < ActiveRecord::Base; end
  675
+
  676
+class Person
  677
+  include ActiveModel::Model
  678
+  include ActiveModel::AttributeMethods
  679
+  include ActiveModel::Serializers::JSON
  680
+
  681
+  attr_accessor :name, :age
  682
+
  683
+  def attributes
  684
+    instance_values
  685
+  end
  686
+end
  687
+
  688
+user.as_json
  689
+=> {"id"=>1, "name"=>"Konata Izumi", "age"=>16, "awesome"=>true}
  690
+# root is not included
  691
+
  692
+person.as_json
  693
+=> {"name"=>"Francesco", "age"=>22}
  694
+# root is not included
  695
+</ruby>
  696
+
510 697
 * Passing false hash values to +validates+ will no longer enable the corresponding validators.
511 698
 
512 699
 * +ConfirmationValidator+ error messages will attach to <tt>:#{attribute}_confirmation</tt> instead of +attribute+.
@@ -525,6 +712,24 @@ h3. Active Resource
525 712
 
526 713
 h3. Active Support
527 714
 
  715
+* <tt>Time#change</tt> now works with time values with offsets other than UTC or the local time zone.
  716
+
  717
+* Add <tt>Time#prev_quarter</tt> and <tt>Time#next_quarter</tt> short-hands for <tt>months_ago(3)</tt> and <tt>months_since(3)</tt>.
  718
+
  719
+* Remove obsolete and unused <tt>require_association</tt> method from dependencies.
  720
+
  721
+* Add <tt>:instance_accessor</tt> option for <tt>config_accessor</tt>.
  722
+
  723
+<ruby>
  724
+class User
  725
+  include ActiveSupport::Configurable
  726
+  config_accessor :allowed_access, instance_accessor: false
  727
+end
  728
+
  729
+User.new.allowed_access = true # => NoMethodError
  730
+User.new.allowed_access        # => NoMethodError
  731
+</ruby>
  732
+
528 733
 * <tt>ActionView::Helpers::NumberHelper</tt> methods have been moved to <tt>ActiveSupport::NumberHelper</tt> and are now available via <tt>Numeric#to_s</tt>.
529 734
 
530 735
 * <tt>Numeric#to_s</tt> now accepts the formatting options :phone, :currency, :percentage, :delimited, :rounded, :human, and :human_size.
@@ -575,6 +780,8 @@ h3. Active Support
575 780
 
576 781
 h4(#activesupport_deprecations). Deprecations
577 782
 
  783
+* <tt>ActiveSupport::Callbacks</tt>: deprecate usage of filter object with <tt>#before</tt> and <tt>#after</tt> methods as <tt>around</tt> callback.
  784
+
578 785
 * <tt>BufferedLogger</tt> is deprecated.  Use <tt>ActiveSupport::Logger</tt> or the +logger+ from Ruby stdlib.
579 786
 
580 787
 * Deprecates the compatibility method <tt>Module#local_constant_names</tt> and use <tt>Module#local_constants</tt> instead (which returns symbols).

0 notes on commit 215d41d

Please sign in to comment.
Something went wrong with that request. Please try again.