2013-05-03 04:46:18 +00:00
|
|
|
* While removing index if column option is missing then raise IrreversibleMigration exception.
|
|
|
|
|
|
|
|
Following code should raise `IrreversibleMigration`. But the code was
|
|
|
|
failing since options is an array and not a hash.
|
|
|
|
|
|
|
|
def change
|
|
|
|
change_table :users do |t|
|
|
|
|
t.remove_index [:name, :email]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Fix was to check if the options is a Hash before operating on it.
|
|
|
|
|
|
|
|
Fixes #10419.
|
|
|
|
|
|
|
|
*Neeraj Singh*
|
|
|
|
|
2013-02-26 02:06:35 +00:00
|
|
|
* Do not overwrite manually built records during one-to-one nested attribute assignment
|
|
|
|
|
|
|
|
For one-to-one nested associations, if you build the new (in-memory)
|
|
|
|
child object yourself before assignment, then the NestedAttributes
|
|
|
|
module will not overwrite it, e.g.:
|
|
|
|
|
|
|
|
class Member < ActiveRecord::Base
|
|
|
|
has_one :avatar
|
|
|
|
accepts_nested_attributes_for :avatar
|
|
|
|
|
|
|
|
def avatar
|
|
|
|
super || build_avatar(width: 200)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
member = Member.new
|
|
|
|
member.avatar_attributes = {icon: 'sad'}
|
|
|
|
member.avatar.width # => 200
|
|
|
|
|
|
|
|
*Olek Janiszewski*
|
|
|
|
|
2013-04-11 03:29:19 +00:00
|
|
|
* fixes bug introduced by #3329. Now, when autosaving associations,
|
|
|
|
deletions happen before inserts and saves. This prevents a 'duplicate
|
|
|
|
unique value' database error that would occur if a record being created had
|
|
|
|
the same value on a unique indexed field as that of a record being destroyed.
|
|
|
|
|
|
|
|
*Johnny Holton*
|
|
|
|
|
2013-05-01 18:33:11 +00:00
|
|
|
* Handle aliased attributes in ActiveRecord::Relation.
|
|
|
|
|
|
|
|
When using symbol keys, ActiveRecord will now translate aliased attribute names to the actual column name used in the database:
|
|
|
|
|
|
|
|
With the model
|
|
|
|
|
|
|
|
class Topic
|
|
|
|
alias_attribute :heading, :title
|
|
|
|
end
|
|
|
|
|
|
|
|
The call
|
|
|
|
|
|
|
|
Topic.where(heading: 'The First Topic')
|
|
|
|
|
|
|
|
should yield the same result as
|
|
|
|
|
|
|
|
Topic.where(title: 'The First Topic')
|
|
|
|
|
|
|
|
This also applies to ActiveRecord::Relation::Calculations calls such as `Model.sum(:aliased)` and `Model.pluck(:aliased)`.
|
|
|
|
|
|
|
|
This will not work with SQL fragment strings like `Model.sum('DISTINCT aliased')`.
|
|
|
|
|
|
|
|
*Godfrey Chan*
|
|
|
|
|
2013-05-01 00:24:29 +00:00
|
|
|
* Mute `psql` output when running rake db:schema:load.
|
|
|
|
|
|
|
|
*Godfrey Chan*
|
|
|
|
|
2013-03-07 21:43:00 +00:00
|
|
|
* Trigger a save on `has_one association=(associate)` when the associate contents have changed.
|
|
|
|
|
|
|
|
Fix #8856.
|
|
|
|
|
|
|
|
*Chris Thompson*
|
|
|
|
|
2013-04-30 17:21:23 +00:00
|
|
|
* Abort a rake task when missing db/structure.sql like `db:schema:load` task.
|
|
|
|
|
|
|
|
*kennyj*
|
2013-05-02 15:09:59 +00:00
|
|
|
|
|
|
|
* rake:db:test:prepare falls back to original environment after execution.
|
|
|
|
|
|
|
|
*Slava Markevich*
|
2013-03-23 18:09:53 +00:00
|
|
|
|
2013-04-29 16:06:45 +00:00
|
|
|
Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/activerecord/CHANGELOG.md) for previous changes.
|