aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r--activerecord/CHANGELOG.md140
1 files changed, 133 insertions, 7 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 526cc874e9..ad766d3267 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,8 +1,134 @@
## Rails 4.0.0 (unreleased) ##
+* If a model was instantiated from the database using `select`, `respond_to?`
+ returns false for non-selected attributes. For example:
+
+ post = Post.select(:title).first
+ post.respond_to?(:body) # => false
+
+ post = Post.select('title as post_title').first
+ post.respond_to?(:title) # => false
+
+ Fixes #4208.
+
+ *Neeraj Singh*
+
+* Run `rake migrate:down` & `rake migrate:up` in transaction if database supports.
+
+ *Alexander Bondarev*
+
+* `0x` prefix must be added when assigning hexadecimal string into `bit` column in PostgreSQL.
+
+ *kennyj*
+
+* Added Statement Cache to allow the caching of a single statement. The cache works by
+ duping the relation returned from yielding a statement, which allows skipping the AST
+ building phase for following executes. The cache returns results in array format.
+
+ Example:
+
+ cache = ActiveRecord::StatementCache.new do
+ Book.where(name: "my book").limit(100)
+ end
+
+ books = cache.execute
+
+ The solution attempts to get closer to the speed of `find_by_sql` but still maintaining
+ the expressiveness of the Active Record queries.
+
+ *Olli Rissanen*
+
+* Preserve context while merging relations with join information.
+
+ class Comment < ActiveRecord::Base
+ belongs_to :post
+ end
+
+ class Author < ActiveRecord::Base
+ has_many :posts
+ end
+
+ class Post < ActiveRecord::Base
+ belongs_to :author
+ has_many :comments
+ end
+
+ `Comment.joins(:post).merge(Post.joins(:author).merge(Author.where(:name => "Joe Blogs"))).all`
+ would fail with
+ `ActiveRecord::ConfigurationError: Association named 'author' was not found on Comment`.
+
+ It is failing because `all` is being called on relation which looks like this after all
+ the merging: `{:joins=>[:post, :author], :where=>[#<Arel::Nodes::Equality: ....}`. In this
+ relation all the context that `Post` was joined with `Author` is lost and hence the error
+ that `author` was not found on `Comment`.
+
+ The solution is to build `JoinAssociation` when two relations with join information are being
+ merged. And later while building the Arel use the previously built `JoinAssociation` record
+ in `JoinDependency#graft` to build the right from clause.
+ Fixes #3002.
+
+ *Jared Armstrong and Neeraj Singh*
+
+* `default_scopes?` is deprecated. Check for `default_scopes.empty?` instead.
+
+ *Agis Anastasopoulos*
+
+* Default values for PostgreSQL bigint types now get parsed and dumped to the
+ schema correctly.
+
+ *Erik Peterson*
+
+* Fix associations with `:inverse_of` option when building association
+ with a block. Inside the block the parent object was different then
+ after the block.
+
+ Example:
+
+ parent.association.build do |child|
+ child.parent.equal?(parent) # false
+ end
+
+ # vs
+
+ child = parent.association.build
+ child.parent.equal?(parent) # true
+
+ *Michal Cichra*
+
+* `has_many` using `:through` now obeys the order clause mentioned in
+ through association.
+ Fixes #10016.
+
+ *Neeraj Singh*
+
+* `belongs_to :touch` behavior now touches old association when
+ transitioning to new association.
+
+ class Passenger < ActiveRecord::Base
+ belongs_to :car, touch: true
+ end
+
+ car_1 = Car.create
+ car_2 = Car.create
+
+ passenger = Passenger.create car: car_1
+
+ passenger.car = car_2
+ passenger.save
+
+ Previously only car_2 would be touched. Now both car_1 and car_2
+ will be touched.
+
+ *Adam Gamble*
+
+* Extract and deprecate Firebird / Sqlserver / Oracle database tasks, because
+ These tasks should be supported by 3rd-party adapter.
+
+ *kennyj*
+
* Allow `ActiveRecord::Base.connection_handler` to have thread affinity and be
- settable, this effectively allows Active Record to be used in a multi threaded
- setup with multiple connections to multiple dbs.
+ settable, this effectively allows Active Record to be used in a multithreaded
+ setup with multiple connections to multiple databases.
*Sam Saffron*
@@ -36,7 +162,8 @@
*Ken Mazaika*
* Add an `add_index` override in PostgreSQL adapter and MySQL adapter
- to allow custom index type support. Fixes #6101.
+ to allow custom index type support.
+ Fixes #6101.
add_index(:wikis, :body, :using => 'gin')
@@ -60,7 +187,6 @@
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.
-
Fixes #9470.
*John Wang*
@@ -1170,7 +1296,7 @@
* Explain only normal CRUD sql (select / update / insert / delete).
Fix problem that explains unexplainable sql.
- Closes #7544 #6458.
+ Fixes #7544 #6458.
*kennyj*
@@ -1799,13 +1925,13 @@
add_index(:accounts, :code, where: 'active')
- Generates
+ generates
CREATE INDEX index_accounts_on_code ON accounts(code) WHERE active
*Marcelo Silveira*
-* Implemented ActiveRecord::Relation#none method.
+* Implemented `ActiveRecord::Relation#none` method.
The `none` method returns a chainable relation with zero records
(an instance of the NullRelation class).