CHANGELOG.md 4.8 KB
Newer Older
1
*   Create indexes inline in CREATE TABLE for MySQL.
2 3 4

    This is important, because adding an index on a temporary table after it has been created
    would commit the transaction.
5 6 7

    It also allows creating and dropping indexed tables with fewer queries and fewer permissions
    required.
8 9 10 11 12 13 14 15

    Example:

        create_table :temp, temporary: true, as: "SELECT id, name, zip FROM a_really_complicated_query" do |t|
          t.index :zip
        end
        # => CREATE TEMPORARY TABLE temp (INDEX (zip)) AS SELECT id, name, zip FROM a_really_complicated_query

16
    *Cody Cutrer*, *Steve Rice*, *Rafael Mendonça Franca*
17

18 19 20 21 22 23
*   Save `has_one` association even if the record doesn't changed.

    Fixes #14407.

    *Rafael Mendonça França*

Y
Yves Senn 已提交
24 25
*   Use singular table name in generated migrations when
    `ActiveRecord::Base.pluralize_table_names` is `false`.
26 27 28 29 30

    Fixes #13426.

    *Kuldeep Aggarwal*

31
*   `touch` accepts many attributes to be touched at once.
32 33 34

    Example:

35 36
        # touches :signed_at, :sealed_at, and :updated_at/on attributes.
        Photo.last.touch(:signed_at, :sealed_at)
37

38 39
    *James Pinto*

40 41 42 43 44 45 46
*   `rake db:structure:dump` only dumps schema information if the schema
    migration table exists.

    Fixes #14217.

    *Yves Senn*

47 48 49 50 51 52 53 54
*   Reap connections that were checked out by now-dead threads, instead
    of waiting until they disconnect by themselves. Before this change,
    a suitably constructed series of short-lived threads could starve
    the connection pool, without ever having more than a couple alive at
    the same time.

    *Matthew Draper*

55 56 57 58 59
*   `pk_and_sequence_for` now ensures that only the pg_depend entries
    pointing to pg_class, and thus only sequence objects, are considered.

    *Josh Williams*

60 61 62 63 64 65
*   `where.not` adds `references` for `includes` like normal `where` calls do.

    Fixes #14406.

    *Yves Senn*

66 67
*   Extend fixture `$LABEL` replacement to allow string interpolation.

68 69 70 71 72 73 74 75
    Example:

        martin:
          email: $LABEL@email.com

        users(:martin).email # => martin@email.com

    *Eric Steele*
76

77 78 79 80 81 82
*   Add support for `Relation` be passed as parameter on `QueryCache#select_all`.

    Fixes #14361.

    *arthurnn*

83 84
*   Passing an Active Record object to `find` is now deprecated.  Call `.id`
    on the object first.
85

86 87
*   Passing an Active Record object to `find` or `exists?` is now deprecated.
    Call `.id` on the object first.
88

89
*   Only use BINARY for MySQL case sensitive uniqueness check when column has a case insensitive collation.
90 91 92

    *Ryuta Kamizono*

93
*   Support for MySQL 5.6 fractional seconds.
94 95 96

    *arthurnn*, *Tatsuhiko Miyagawa*

97 98 99 100 101
*   Support for Postgres `citext` data type enabling case-insensitive where
    values without needing to wrap in UPPER/LOWER sql functions.

    *Troy Kruthoff*, *Lachlan Sylvester*

102
*   Allow strings to specify the `#order` value.
103 104 105 106 107

    Example:

        Model.order(id: 'asc').to_sql == Model.order(id: :asc).to_sql

108
    *Marcelo Casiraghi*, *Robin Dupret*
109

110 111 112 113 114
*   Dynamically register PostgreSQL enum OIDs. This prevents "unknown OID"
    warnings on enum columns.

    *Dieter Komendera*

115 116 117 118 119 120 121
*   `includes` is able to detect the right preloading strategy when string
    joins are involved.

    Fixes #14109.

    *Aaron Patterson*, *Yves Senn*

122 123 124 125
*   Fixed error with validation with enum fields for records where the
    value for any enum attribute is always evaluated as 0 during
    uniqueness validation.

126
    Fixes #14172.
127 128 129

    *Vilius Luneckas* *Ahmed AbouElhamayed*

130 131 132 133 134
*   `before_add` callbacks are fired before the record is saved on
    `has_and_belongs_to_many` assocations *and* on `has_many :through`
    associations.  Before this change, `before_add` callbacks would be fired
    before the record was saved on `has_and_belongs_to_many` associations, but
    *not* on `has_many :through` associations.
135

136
    Fixes #14144.
137

138 139 140 141 142 143 144
*   Fixed STI classes not defining an attribute method if there is a
    conflicting private method defined on its ancestors.

    Fixes #11569.

    *Godfrey Chan*

145
*   Coerce strings when reading attributes. Fixes #10485.
146 147 148 149 150 151 152 153 154

    Example:

        book = Book.new(title: 12345)
        book.save!
        book.title # => "12345"

    *Yves Senn*

155 156 157 158 159 160 161 162 163 164 165
*   Deprecate half-baked support for PostgreSQL range values with excluding beginnings.
    We currently map PostgreSQL ranges to Ruby ranges. This conversion is not fully
    possible because the Ruby range does not support excluded beginnings.

    The current solution of incrementing the beginning is not correct and is now
    deprecated. For subtypes where we don't know how to increment (e.g. `#succ`
    is not defined) it will raise an ArgumentException for ranges with excluding
    beginnings.

    *Yves Senn*

166 167 168 169
*   Support for user created range types in PostgreSQL.

    *Yves Senn*

170
Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activerecord/CHANGELOG.md) for previous changes.