diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG.md | 33 | ||||
-rw-r--r-- | activerecord/lib/active_record/attribute_assignment.rb | 10 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 1 |
3 files changed, 23 insertions, 21 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 4a6e79c68e..9556ed2468 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,6 +1,7 @@ ## Rails 4.0.0 (unreleased) ## + * After extraction of mass-assignment attributes (which protects [id, type] - by default) we can pass id to update_attributes and it will update + by default) we can pass id to `update_attributes` and it will update another record because id will be used in where statement. We never have to change id in where statement because we try to set/replace fields for already loaded record but we have to try to set new id for that record. @@ -12,11 +13,11 @@ *Ian Young* -* If inverse_of is true on an association, then when one calls +find()+ on - the association, ActiveRecord will first look through the in-memory objects +* If ``:inverse_of` is true on an association, then when one calls `find()` on + the association, Active Record will first look through the in-memory objects in the association for a particular id. Then, it will go to the DB if it - is not found. This is accomplished by calling +find_by_scan+ in - collection associations whenever +options[:inverse_of]+ is not nil. + is not found. This is accomplished by calling `find_by_scan` in + collection associations whenever `options[:inverse_of]` is not nil. Fixes #9470. @@ -103,11 +104,11 @@ *Yves Senn* -* Fix quoting for sqlite migrations using copy_table_contents() with binary +* Fix quoting for sqlite migrations using `copy_table_contents` with binary columns. These would fail with "SQLite3::SQLException: unrecognized token" because - the column was not being passed to quote() so the data was not quoted + the column was not being passed to `quote` so the data was not quoted correctly. *Matthew M. Boedicker* @@ -280,7 +281,7 @@ *John Wang* -* Postgresql timestamp with time zone (timestamptz) datatype now returns a +* PostgreSQL timestamp with time zone (timestamptz) datatype now returns a ActiveSupport::TimeWithZone instance instead of a string *Troy Kruthoff* @@ -510,7 +511,7 @@ *James Miller* -* Allow store accessors to be overrided like other attribute methods, e.g.: +* Allow store accessors to be overridden like other attribute methods, e.g.: class User < ActiveRecord::Base store :settings, accessors: [ :color, :homepage ], coder: JSON @@ -533,7 +534,7 @@ *Dylan Smith* * Schema dumper supports dumping the enabled database extensions to `schema.rb` - (currently only supported by postgresql). + (currently only supported by PostgreSQL). *Justin George* @@ -697,7 +698,7 @@ *Yves Senn* -* Add ability for postgresql adapter to disable user triggers in `disable_referential_integrity`. +* Add ability for PostgreSQL adapter to disable user triggers in `disable_referential_integrity`. Fixes #5523. *Gary S. Weaver* @@ -821,14 +822,14 @@ *Carlos Antonio da Silva* -* Fix postgresql adapter to handle BC timestamps correctly +* Fix PostgreSQL adapter to handle BC timestamps correctly HistoryEvent.create!(name: "something", occured_at: Date.new(0) - 5.years) *Bogdan Gusiev* -* When running migrations on Postgresql, the `:limit` option for `binary` and `text` columns is silently dropped. - Previously, these migrations caused sql exceptions, because Postgresql doesn't support limits on these types. +* When running migrations on PostgreSQL, the `:limit` option for `binary` and `text` columns is silently dropped. + Previously, these migrations caused sql exceptions, because PostgreSQL doesn't support limits on these types. *Victor Costan* @@ -1460,7 +1461,7 @@ *Egor Lynko* -* Added support for specifying the precision of a timestamp in the postgresql +* Added support for specifying the precision of a timestamp in the PostgreSQL adapter. So, instead of having to incorrectly specify the precision using the `:limit` option, you may use `:precision`, as intended. For example, in a migration: @@ -1728,7 +1729,7 @@ * Added the schema cache dump feature. - `Schema cache dump` feature was implemetend. This feature can dump/load internal state of `SchemaCache` instance + `Schema cache dump` feature was implemented. This feature can dump/load internal state of `SchemaCache` instance because we want to boot rails more quickly when we have many models. Usage notes: diff --git a/activerecord/lib/active_record/attribute_assignment.rb b/activerecord/lib/active_record/attribute_assignment.rb index ecfa556ab4..e536f5ebcc 100644 --- a/activerecord/lib/active_record/attribute_assignment.rb +++ b/activerecord/lib/active_record/attribute_assignment.rb @@ -81,7 +81,7 @@ module ActiveRecord end def extract_callstack_for_multiparameter_attributes(pairs) - attributes = { } + attributes = {} pairs.each do |(multiparameter_name, value)| attribute_name = multiparameter_name.split("(").first @@ -146,7 +146,7 @@ module ActiveRecord end else # else column is a timestamp, so if Date bits were not provided, error - validate_missing_parameters!([1,2,3]) + validate_required_parameters!([1,2,3]) # If Date bits were provided but blank, then return nil return if blank_date_parameter? @@ -172,14 +172,14 @@ module ActiveRecord def read_other(klass) max_position = extract_max_param positions = (1..max_position) - validate_missing_parameters!(positions) + validate_required_parameters!(positions) set_values = values.values_at(*positions) klass.new(*set_values) end # Checks whether some blank date parameter exists. Note that this is different - # than the validate_missing_parameters! method, since it just checks for blank + # than the validate_required_parameters! method, since it just checks for blank # positions instead of missing ones, and does not raise in case one blank position # exists. The caller is responsible to handle the case of this returning true. def blank_date_parameter? @@ -187,7 +187,7 @@ module ActiveRecord end # If some position is not provided, it errors out a missing parameter exception. - def validate_missing_parameters!(positions) + def validate_required_parameters!(positions) if missing_parameter = positions.detect { |position| !values.key?(position) } raise ArgumentError.new("Missing Parameter - #{name}(#{missing_parameter})") end diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 0ebe46be55..0f4ab68b61 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -18,6 +18,7 @@ module ActiveRecord autoload :ColumnDefinition autoload :TableDefinition autoload :Table + autoload :AlterTable end autoload_at 'active_record/connection_adapters/abstract/connection_pool' do |