aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r--activerecord/CHANGELOG.md125
1 files changed, 123 insertions, 2 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index f1cca0ad76..db21d323f6 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,5 +1,126 @@
## Rails 4.0.0 (unreleased) ##
+* Allow store accessors to be overrided like other attribute methods, e.g.:
+
+ class User < ActiveRecord::Base
+ store :settings, accessors: [ :color, :homepage ], coder: JSON
+
+ def color
+ super || 'red'
+ end
+ end
+
+ *Sergey Nartimov*
+
+* Quote numeric values being compared to non-numeric columns. Otherwise,
+ in some database, the string column values will be coerced to a numeric
+ allowing 0, 0.0 or false to match any string starting with a non-digit.
+
+ Example:
+
+ App.where(apikey: 0) # => SELECT * FROM users WHERE apikey = '0'
+
+ *Dylan Smith*
+
+* Schema dumper supports dumping the enabled database extensions to `schema.rb`
+ (currently only supported by postgresql).
+
+ *Justin George*
+
+* The `DATABASE_URL` environment variable now converts ints, floats, and
+ the strings true and false to Ruby types. For example, SQLite requires
+ that the timeout value is an integer, and PostgreSQL requires that the
+ prepared_statements option is a boolean. These now work as expected:
+
+ Example:
+
+ DATABASE_URL=sqlite3://localhost/test_db?timeout=500
+ DATABASE_URL=postgresql://localhost/test_db?prepared_statements=false
+
+ *Aaron Stone*
+
+* `Relation#merge` now only overwrites where values on the LHS of the
+ merge. Consider:
+
+ left = Person.where(age: [13, 14, 15])
+ right = Person.where(age: [13, 14]).where(age: [14, 15])
+
+ `left` results in the following SQL:
+
+ WHERE age IN (13, 14, 15)
+
+ `right` results in the following SQL:
+
+ WHERE age IN (13, 14) AND age IN (14, 15)
+
+ Previously, `left.merge(right)` would result in all but the last
+ condition being removed:
+
+ WHERE age IN (14, 15)
+
+ Now it results in the LHS condition(s) for `age` being removed, but
+ the RHS remains as it is:
+
+ WHERE age IN (13, 14) AND age IN (14, 15)
+
+ *Jon Leighton*
+
+* Fix handling of dirty time zone aware attributes
+
+ Previously, when `time_zone_aware_attributes` were enabled, after
+ changing a datetime or timestamp attribute and then changing it back
+ to the original value, `changed_attributes` still tracked the
+ attribute as changed. This caused `[attribute]_changed?` and
+ `changed?` methods to return true incorrectly.
+
+ Example:
+
+ in_time_zone 'Paris' do
+ order = Order.new
+ original_time = Time.local(2012, 10, 10)
+ order.shipped_at = original_time
+ order.save
+ order.changed? # => false
+
+ # changing value
+ order.shipped_at = Time.local(2013, 1, 1)
+ order.changed? # => true
+
+ # reverting to original value
+ order.shipped_at = original_time
+ order.changed? # => false, used to return true
+ end
+
+ *Lilibeth De La Cruz*
+
+* When `#count` is used in conjunction with `#uniq` we perform `count(:distinct => true)`.
+ Fix #6865.
+
+ Example:
+
+ relation.uniq.count # => SELECT COUNT(DISTINCT *)
+
+ *Yves Senn + Kaspar Schiess*
+
+* PostgreSQL ranges type support. Includes: int4range, int8range,
+ numrange, tsrange, tstzrange, daterange
+
+ Ranges can be created with inclusive and exclusive bounds.
+
+ Example:
+
+ create_table :Room do |t|
+ t.daterange :availability
+ end
+
+ Room.create(availability: (Date.today..Float::INFINITY))
+ Room.first.availability # => Wed, 19 Sep 2012..Infinity
+
+ One thing to note: Range class does not support exclusive lower
+ bound.
+
+ *Alexander Grebennik*
+
* Added a state instance variable to each transaction. Will allow other objects
to know whether a transaction has been committed or rolled back.
@@ -497,7 +618,7 @@
After:
- #=> SELECT * FROM users WHERE 1 = 2;
+ #=> SELECT * FROM users WHERE 1=0;
*Damien Mathieu*
@@ -519,7 +640,7 @@
*Matt Jones*
-* Accept belongs_to (including polymorphic) association keys in queries.
+* Accept `belongs_to` (including polymorphic) association keys in queries.
The following queries are now equivalent: