diff options
Diffstat (limited to 'activerecord')
6 files changed, 112 insertions, 18 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index f69f803513..cea50aaa9d 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -134,8 +134,11 @@ * The threshold for auto EXPLAIN is ignored if there's no logger. *fxn* +* Call `to_s` on the value passed to `table_name=`, in particular symbols + are supported (regression). *Sergey Nartimov* + * Fix possible race condition when two threads try to define attribute - methods for the same class. + methods for the same class. *Jon Leighton* ## Rails 3.2.0 (January 20, 2012) ## @@ -317,7 +320,34 @@ *Aaron Christy* -## Rails 3.1.3 (November 20, 2011) ## + ## Rails 3.1.4 (unreleased) ## + + * Fix a custom primary key regression *GH 3987* + + *Jon Leighton* + + * Perf fix (second try): don't load records for `has many :dependent => + :delete_all` *GH 3672* + + *Jon Leighton* + + * Fix accessing `proxy_association` method from an association extension + where the calls are chained. *GH #3890* + + (E.g. `post.comments.where(bla).my_proxy_method`) + + *Jon Leighton* + + * Perf fix: MySQL primary key lookup was still slow for very large + tables. *GH 3678* + + *Kenny J* + + * Perf fix: If a table has no primary key, don't repeatedly ask the database for it. + + *Julius de Bruijn* + +### Rails 3.1.3 (November 20, 2011) ## * Perf fix: If we're deleting all records in an association, don't add a IN(..) clause to the query. *GH 3672* @@ -330,7 +360,7 @@ *Christos Zisopoulos and Kenny J* -## Rails 3.1.2 (November 18, 2011) ## +### Rails 3.1.2 (November 18, 2011) ## * Fix bug with PostgreSQLAdapter#indexes. When the search path has multiple schemas, spaces were not being stripped from the schema names after the first. @@ -749,6 +779,58 @@ *Aaron Patterson* +## Rails 3.0.12 (unreleased) ## + +* No changes. + + +## Rails 3.0.11 (November 18, 2011) ## + +* Exceptions from database adapters should not lose their backtrace. + +* Backport "ActiveRecord::Persistence#touch should not use default_scope" (GH #1519) + +* Psych errors with poor yaml formatting are proxied. Fixes GH #2645 and + GH #2731 + +* Fix ActiveRecord#exists? when passsed a nil value + + +## Rails 3.0.10 (August 16, 2011) ## + +* Magic encoding comment added to schema.rb files + +* schema.rb is written as UTF-8 by default. + +* Ensuring an established connection when running `rake db:schema:dump` + +* Association conditions will not clobber join conditions. + +* Destroying a record will destroy the HABTM record before destroying itself. + GH #402. + +* Make `ActiveRecord::Batches#find_each` to not return `self`. + +* Update `table_exists?` in PG to to always use current search_path or schema if explictly set. + + +## Rails 3.0.9 (June 16, 2011) ## + +* No changes. + + +## Rails 3.0.8 (June 7, 2011) ## + +* Fix various problems with using :primary_key and :foreign_key options in conjunction with + :through associations. [Jon Leighton] + +* Correctly handle inner joins on polymorphic relationships. + +* Fixed infinity and negative infinity cases in PG date columns. + +* Creating records with invalid associations via `create` or `save` will no longer raise exceptions. + + ## Rails 3.0.7 (April 18, 2011) ## * Destroying records via nested attributes works independent of reject_if LH #6006 *Durran Jordan* diff --git a/activerecord/lib/active_record/aggregations.rb b/activerecord/lib/active_record/aggregations.rb index 5a8addc4e4..c39284539c 100644 --- a/activerecord/lib/active_record/aggregations.rb +++ b/activerecord/lib/active_record/aggregations.rb @@ -46,7 +46,7 @@ module ActiveRecord # # def <=>(other_money) # if currency == other_money.currency - # amount <=> amount + # amount <=> other_money.amount # else # amount <=> other_money.exchange_to(currency).amount # end diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index d468663084..4bafadc666 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -78,7 +78,7 @@ module ActiveRecord # When <tt>:autosave</tt> is not declared new children are saved when their parent is saved: # # class Post - # has_many :comments # :autosave option is no declared + # has_many :comments # :autosave option is not declared # end # # post = Post.new(:title => 'ruby rocks') @@ -93,7 +93,8 @@ module ActiveRecord # post.comments.create(:body => 'hello world') # post.save # => saves both post and comment # - # When <tt>:autosave</tt> is true all children is saved, no matter whether they are new records: + # When <tt>:autosave</tt> is true all children are saved, no matter whether they + # are new records or not: # # class Post # has_many :comments, :autosave => true diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index eec7efadc2..e33903622b 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -484,15 +484,26 @@ module ActiveRecord # Maps logical Rails types to MySQL-specific data types. def type_to_sql(type, limit = nil, precision = nil, scale = nil) - return super unless type.to_s == 'integer' - - case limit - when 1; 'tinyint' - when 2; 'smallint' - when 3; 'mediumint' - when nil, 4, 11; 'int(11)' # compatibility with MySQL default - when 5..8; 'bigint' - else raise(ActiveRecordError, "No integer type has byte size #{limit}") + case type.to_s + when 'integer' + case limit + when 1; 'tinyint' + when 2; 'smallint' + when 3; 'mediumint' + when nil, 4, 11; 'int(11)' # compatibility with MySQL default + when 5..8; 'bigint' + else raise(ActiveRecordError, "No integer type has byte size #{limit}") + end + when 'text' + case limit + when 0..0xff; 'tinytext' + when nil, 0x100..0xffff; 'text' + when 0x10000..0xffffff; 'mediumtext' + when 0x1000000..0xffffffff; 'longtext' + else raise(ActiveRecordError, "No text type has character length #{limit}") + end + else + super end end diff --git a/activerecord/test/schema/mysql2_specific_schema.rb b/activerecord/test/schema/mysql2_specific_schema.rb index ab2c7ccc10..65b6f9f227 100644 --- a/activerecord/test/schema/mysql2_specific_schema.rb +++ b/activerecord/test/schema/mysql2_specific_schema.rb @@ -1,5 +1,5 @@ ActiveRecord::Schema.define do - create_table :binary_fields, :force => true, :options => 'CHARACTER SET latin1' do |t| + create_table :binary_fields, :force => true do |t| t.binary :tiny_blob, :limit => 255 t.binary :normal_blob, :limit => 65535 t.binary :medium_blob, :limit => 16777215 @@ -32,4 +32,4 @@ CREATE TABLE collation_tests ( ) CHARACTER SET utf8 COLLATE utf8_general_ci SQL -end
\ No newline at end of file +end diff --git a/activerecord/test/schema/mysql_specific_schema.rb b/activerecord/test/schema/mysql_specific_schema.rb index a0adfe3752..7d324f98c4 100644 --- a/activerecord/test/schema/mysql_specific_schema.rb +++ b/activerecord/test/schema/mysql_specific_schema.rb @@ -1,5 +1,5 @@ ActiveRecord::Schema.define do - create_table :binary_fields, :force => true, :options => 'CHARACTER SET latin1' do |t| + create_table :binary_fields, :force => true do |t| t.binary :tiny_blob, :limit => 255 t.binary :normal_blob, :limit => 65535 t.binary :medium_blob, :limit => 16777215 |