aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix @tenderlove's name in changelog :sparkles:Carlos Antonio da Silva2013-06-261-2/+2
| | | | [ci skip]
* Add changelog entry for database tasks removal #10853 [ci skip]Carlos Antonio da Silva2013-06-251-0/+4
|
* Merge pull request #10992 from Empact/find-each-enumeratorCarlos Antonio da Silva2013-06-251-0/+5
|\ | | | | | | When .find_each is called without a block, return an Enumerator.
| * When .find_each is called without a block, return an Enumerator.Ben Woosley2013-06-191-0/+5
| | | | | | | | This lets us do things like call: .find_each.with_index
* | Merge pull request #10993 from Empact/result-each-enumeratorCarlos Antonio da Silva2013-06-251-0/+5
|\ \ | | | | | | | | | Change Result#each to return an Enumerator when called without a block.
| * | Change Result#each to return an Enumerator when called without a block.Ben Woosley2013-06-181-0/+5
| | | | | | | | | | | | As with #10992, this lets us call #with_index, etc on the results.
* | | remove trailing whitespace from Active Record CHANGELOGYves Senn2013-06-251-1/+1
| | |
* | | flatten merged join_values before building the joinsNeeraj Singh2013-06-221-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | fixes #10669 While joining_values special treatment is given to string values. By flattening the array it ensures that string values are detected as strings and not arrays.
* | | do not load all child records for inverse caseNeeraj Singh2013-06-211-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | currently `post.comments.find(Comment.first.id)` would load all comments for the given post to set the inverse association. This has a huge performance penalty. Because if post has 100k records and all these 100k records would be loaded in memory even though the comment id was supplied. Fix is to use in-memory records only if loaded? is true. Otherwise load the records using full sql. Fixes #10509
* | | `inspect` for AR model classes does not initiate a new connection.Yves Senn2013-06-201-0/+11
| | |
* | | add forgotten CHANGELOG entry for #10884.Yves Senn2013-06-191-0/+5
| | |
* | | Revert "Merge pull request #10566 from neerajdotname/10509d"Jon Leighton2013-06-191-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2b817a5e89ac0e7aeb894a40ae7151a0cf3cef16, reversing changes made to 353a398bee68c5ea99d76ac7601de0a5fef6f4a5. Conflicts: activerecord/CHANGELOG.md Reason: the build broke
* | | log the sql that is actually sent to the databaseNeeraj Singh2013-06-191-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If I have a query that produces sql `WHERE "users"."name" = 'a b'` then in the log all the whitespace is being squeezed. So the sql that is printed in the log is `WHERE "users"."name" = 'a b'`. This can be confusing. This commit fixes it by ensuring that whitespace is not squeezed. fixes #10982
* | | do not load all child records for inverse caseNeeraj Singh2013-06-191-0/+16
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | currently `post.comments.find(Comment.first.id)` would load all comments for the given post to set the inverse association. This has a huge performance penalty. Because if post has 100k records and all these 100k records would be loaded in memory even though the comment id was supplied. Fix is to use in-memory records only if loaded? is true. Otherwise load the records using full sql. Fixes #10509
* | Fix formatting of my name in the changelog, and given Aaron credit for ↵Ben Woosley2013-06-181-1/+3
| | | | | | | | b483a0d2a75b
* | It takes 4 spaces or some backticks to have this code displayed as code in ↵Ben Woosley2013-06-181-23/+23
|/ | | | the changelog.
* fixture setup does not rely on `AR::Base.configurations`.Yves Senn2013-06-151-0/+5
| | | | | | | | As you can also configure your database connection using `ENV["DATABASE_URL"]`, the fixture setup can't reply on the `.configurations` Hash. As the fixtures are only loaded when ActiveRecord is actually used (`rails/test_help.rb`) it should be safe to drop the check for an existing configuration.
* regression test + mysql2 adapter raises correct error if conn is closed.Yves Senn2013-06-151-0/+5
|
* cleanup, remove trailing whitespace from AR changelogYves Senn2013-06-151-4/+4
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2013-06-141-2/+2
|\ | | | | | | | | Conflicts: guides/source/upgrading_ruby_on_rails.md
| * Consistent use of one space only after punctuationSunny Ripert2013-05-281-2/+2
| |
* | Ambiguous reflections are on :through relationships are no longer supported.Aaron Patterson2013-06-131-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, you need to change this: class Author < ActiveRecord::Base has_many :posts has_many :taggings, :through => :posts end class Post < ActiveRecord::Base has_one :tagging has_many :taggings end class Tagging < ActiveRecord::Base end To this: class Author < ActiveRecord::Base has_many :posts has_many :taggings, :through => :posts, :source => :tagging end class Post < ActiveRecord::Base has_one :tagging has_many :taggings end class Tagging < ActiveRecord::Base end
* | Fix typos in AR changelog [ci skip]Prathamesh Sonpatki2013-06-121-2/+2
| |
* | Remove fall back and column restrictions for `count`.Yves Senn2013-06-091-0/+16
| |
* | Getting rid of the +automatic_inverse_of: false+ option in associations in favorwangjohn2013-06-081-0/+21
| | | | | | | | | | of using +inverse_of: false+ option. Changing the documentation and adding a CHANGELOG entry for the automatic inverse detection feature.
* | Fixes #10432 add_column not creating array columns in PostgreSQLAdam Anderson2013-06-041-0/+4
| | | | | | | | | | | | When then PostgreSQL visitor was [added](https://github.com/rails/rails/commit/6b7fdf3bf3675a14eae74acc5241089308153a34) `add_column` was no longer receiving the column options directly. This caused the options to be lost along the way.
* | `implicit_readonly` is being removed in favor of calling `readonly` explicitlyYves Senn2013-05-271-0/+12
| |
* | Fix the `:primary_key` option for `has_many` associations.Yves Senn2013-05-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When removing records from a `has_many` association it used the `primary_key` defined on the association. Our test suite didn't fail because on all occurences of `:primary_key`, the specified column was available in both tables. This prevented the code from raising an exception but it still behaved badly. I added a test-case to prevent regressions that failed with: ``` 1) Error: HasManyAssociationsTest#test_has_many_assignment_with_custom_primary_key: ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: essays.first_name: UPDATE "essays" SET "writer_id" = NULL WHERE "essays"."writer_id" = ? AND "essays"."first_name" IS NULL ```
* | Add CHANGELOG entry for 99860582b2b1c0fc42bf84c52aac57b243d42678Rafael Mendonça França2013-05-221-0/+6
|/
* Fxied some typosPrathamesh Sonpatki2013-05-181-1/+1
|
* Also support extensions in PostgreSQL 9.1, because this has been supported ↵kennyj2013-05-151-0/+4
| | | | since 9.1.
* Merge pull request #10556 from Empact/deprecate-schema-statements-distinctRafael Mendonça França2013-05-121-0/+5
| | | | | | Deprecate SchemaStatements#distinct, and make SchemaStatements#columns_for_distinct nodoc. Conflicts: activerecord/CHANGELOG.md
* Improve CHANGELOG entry [ci kip]Rafael Mendonça França2013-05-111-6/+10
|
* Call assume_migrated_upto_version on connectionKyle Stevens2013-05-111-0/+11
| | | | | | | | | | | Call assume_migrated_upto_version on connection to prevent it from first being picked up in method_missing. In the base class, Migration, method_missing expects the argument to be a table name, and calls proper_table_name on the arguments before sending to connection. If table_name_prefix or table_name_suffix is used, the schema version changes to prefix_version_suffix, breaking `rake test:prepare`. Fixes #10411.
* read_attribute_before_type_cast should accept symbolNeeraj Singh2013-05-111-0/+4
|
* Fix Typo existant -> existent [ci skip]Prathamesh Sonpatki2013-05-081-1/+1
|
* Improve CHANGELOG entry [ci skip]Rafael Mendonça França2013-05-061-4/+4
|
* Merge pull request #10489 from greenriver/ar_counter_cache_multiple_destroyRafael Mendonça França2013-05-061-1/+5
|\ | | | | | | | | | | | | Confirm a record has not already been destroyed before decrementing counter cache Conflicts: activerecord/CHANGELOG.md
| * Confirm a record has not already been destroyed before decrementingBen Tucker2013-05-061-0/+4
| | | | | | | | | | | | | | | | | | counter cache At present, calling destroy multiple times on the same record results in the belongs_to counter cache being decremented multiple times. With this change the record is checked for whether it is already destroyed prior to decrementing the counter cache.
* | Fix bug in ActiveRecord::Sanitization#sanitize_sql_hash_for_conditionsZach Ohlgren2013-05-061-3/+10
| | | | | | | | | | | | | | | | Fixing CHANGLOG description Remove extra line. Remove blank lines.
* | raise IrreversibleMigration if no column givenNeeraj Singh2013-05-061-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes #10419 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.
* | Do not overwrite manually built records during one-to-one nested attribute ↵Olek Janiszewski2013-05-031-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge pull request #10417 from jholton/fix_association_auto_saveJon Leighton2013-05-031-0/+7
|\ \ | | | | | | autosave_association issue that occurs when table has unique index (resubmission)
| * | destroys association records before saving/inserting new association recordsJohnny Holton2013-05-021-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes bug introduced by #3329 These are the conditions necessary to reproduce the bug: - For an association, autosave => true. - An association record is being destroyed - A new association record is being created. - There is a unique index one of the association's fields. - The record being created has the same value as the record being destroyed on the indexed field. Before, the deletion of records was postponed until after all insertions/saves. Therefore the new record with the identical value in the indexed field caused a non-unique value error to be thrown at the database level. With this fix, the deletions happen first, before the insertions/saves. Therefore the record with the duplicate value is gone from the database before the new record is created, thereby avoiding the non-uniuqe value error.
* | | rake:db:test:prepare falls back to original environment after execution.markevich2013-05-021-0/+4
|/ /
* / Handle aliased attributes in ActiveRecord::Relation.Godfrey Chan2013-05-011-0/+24
|/ | | | | | | | | | | | | | | | | | | | | | | | | | 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')`. Github #7839 *Godfrey Chan*
* Mute psql output when running rake db:schema:loadGodfrey Chan2013-04-301-0/+4
|
* Fix #8856 Ensure has_one association=(associate) triggers save.Chris Thompson2013-04-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | | activerecord/lib/active_record/associations.rb states: # [association=(associate)] # Assigns the associate object, extracts the primary key, sets it as the foreign key, # and saves the associate object. Since commit 42dd5d9f2976677a4bf22347f2dde1a8135dfbb4 to fix #7191, this is no longer the case if the associate has changed, but is the same object. For example: # Pirate has_one :ship pirate = Pirate.create!(catchphrase: "A Pirate") ship = pirate.build_ship(name: 'old name') ship.save! ship.name = 'new name' pirate.ship = ship That last line should trigger a save. Although we are not changing the association, the associate (ship) has changed.
* Abort a rake task when missing db/structure.sql like `db:schema:load` task.kennyj2013-05-011-1/+3
|
* rails/master is now 4.1.0.betaRafael Mendonça França2013-04-291-2043/+2
|