aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
Commit message (Collapse)AuthorAgeFilesLines
* Fix after_commit warning messageArthur Neves2014-08-181-1/+1
|
* Fixes the `Relation#exists?` to work with polymorphic associations.Kassio Borges2014-08-181-1/+1
| | | | Fixes #15821.
* Merge pull request #16537 from arthurnn/stop_swallowing_errors_2Godfrey Chan2014-08-182-11/+45
|\ | | | | Add option to stop swallowing errors on callbacks.
| * Add option to stop swallowing errors on callbacks.Arthur Neves2014-08-182-11/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, Active Record will rescue any errors raised within after_rollback/after_create callbacks and print them to the logs. Next versions of rails will not rescue those errors anymore, and just bubble them up, as the other callbacks. This adds a opt-in flag to enable that behaviour, of not rescuing the errors. Example: # For not swallow errors in after_commit/after_rollback config.active_record.errors_in_transactional_callbacks = true [fixes #13460]
* | Check attributes passed to create_with and whereRafael Mendonça França2014-08-181-2/+14
|/ | | | | | | | | | | If the request parameters are passed to create_with and where they can be used to do mass assignment when used in combination with Relation#create. Fixes CVE-2014-3514 Conflicts: activerecord/lib/active_record/relation/query_methods.rb
* Merge pull request #15889 from carnesmedia/model-nameRafael Mendonça França2014-08-171-4/+4
|\ | | | | | | Use #model_name on instances instead of classes
| * Use #model_name on instances instead of classesAmiel Martin2014-06-241-4/+4
| | | | | | | | | | | | This allows rails code to be more confdent when asking for a model name, instead of having to ask for the class. Rails core discussion here: https://groups.google.com/forum/#!topic/rubyonrails-core/ThSaXw9y1F8
* | Merge pull request #16062 from sgrif/sg-required-generatorsRafael Mendonça França2014-08-172-2/+2
|\ \ | | | | | | Add a `required` option to the model generator
| * | Add a `required` option to the model generatorSean Griffin2014-08-082-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Syntax was chosen to follow the passing of multiple options to decimal/numeric types. Curly braces, and allowing any of `,`, `.`, or `-` to be used as a separator to avoid the need for shell quoting. (I'm intending to expand this to all columns, but that's another PR. The `required` option will cause 2 things to change. `required: true` will be added to the association. `null: false` will be added to the column in the migration.
* | | Merge pull request #16481 from sgrif/sg-change-default-timestampsDavid Heinemeier Hansson2014-08-174-9/+27
|\ \ \ | | | | | | | | Change the default `null` value for timestamps
| * | | Change the default `null` value for timestampsSean Griffin2014-08-124-9/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As per discussion, this changes the model generators to specify `null: false` for timestamp columns. A warning is now emitted if `timestamps` is called without a `null` option specified, so we can safely change the behavior when no option is specified in Rails 5.
* | | | Merge pull request #16458 from chancancode/ar_fix_reserved_inheritanceGodfrey Chan2014-08-171-5/+8
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue w/custom accessors + reserved name + inheritance Conflicts: activerecord/CHANGELOG.md
| * | | | Fixed issue w/custom accessors + reserved name + inheritanceGodfrey Chan2014-08-111-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed an issue where custom accessor methods (such as those generated by `enum`) with the same name as a global method are incorrectly overridden when subclassing. This was partially fixed in 4155431 then broken again by e5f15a8. Fixes #16288.
* | | | | Don't expose these new APIs yet (added in 877ea78 / #16189)Godfrey Chan2014-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | WARNING: don't use them! They might change or go away between future beta/RC/ patch releases! Also added a CHANGELOG entry for this.
* | | | | Implement `_was` and `changes` for in-place mutations of AR attributesSean Griffin2014-08-166-18/+25
| | | | |
* | | | | Merge pull request #16517 from sgrif/sg-comparable-attributesRafael Mendonça França2014-08-162-0/+14
|\ \ \ \ \ | | | | | | | | | | | | Implement `==` on `Type::Value` and `Attribute`
| * | | | | Implement `==` on `Type::Value` and `Attribute`Sean Griffin2014-08-152-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a small self contained piece of the refactoring that I am working on, which required these objects to be comparable.
* | | | | | Fix regression on after_commit in nested transactions.Arthur Neves2014-08-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after_commit should not run in nested transactions, however they should run once the outermost transaction gets committed. This patch fixes the problem copying the records from the Savepoint to its parent. So the RealTransaction will have all records that needs to run callbacks on it. [fixes #16425]
* | | | | | Use *_transaction methods in TransactionManagerArthur Neves2014-08-151-4/+2
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | Use `commit_transaction`/`rollback_transaction` on `within_new_transaction` method, so they make sure they `pop` the transaction from the stack before calling the methods `commit`/`rollback`.
* | | | | Merge pull request #16505 from sgrif/sg-attribute-internalsYves Senn2014-08-151-2/+3
|\ \ \ \ \ | | | | | | | | | | | | Use the method for determining attribute methods rather than duplicating
| * | | | | Use the method for determining attribute methods rather than duplicatingSean Griffin2014-08-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've been trying to reduce the number of places that care about `attributes`, and its existence. We have a method for this check, let's use it instead.
* | | | | | Spelling errorsjbsmith862014-08-143-4/+4
|/ / / / /
* | | | | Use string for order argument, fixed from #16501 [ci skip]Zachary Scott2014-08-141-1/+1
| | | | |
* | | | | Merge pull request #16501 from tomkadwill/update_delete_to_new_styleZachary Scott2014-08-141-1/+1
|\ \ \ \ \ | | | | | | | | | | | | [ci skip] updated 'where' in association documention to new style syntax
| * | | | | [ci skip] updated 'where' in association documention to new style syntaxTom Kadwill2014-08-141-1/+1
| | |/ / / | |/| | |
* | | | | Merge pull request #16502 from bogdan/where-hash-nested-relationSantiago Pastorino2014-08-141-3/+15
|\ \ \ \ \ | | | | | | | | | | | | [Regression 4.0 -> 4.1] Fixed AR::Relation#where edge case with Hash and other Relation
| * | | | | Fixed AR::Relation#where edge case with Hash and other RelationBogdan Gusiev2014-08-141-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: Author.where(posts: { author_id: Author.where(country_id: 1) }).joins(:posts)
* | | | | | Merge pull request #8813 from ↵Yves Senn2014-08-141-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | greyblake/dont_write_timestamps_if_they_are_not_attributes Write timestamps only if there are timestamps columns Conflicts: activerecord/CHANGELOG.md
| * | | | | | Do not try to write timestamps if they are missing #8813Potapov Sergey2014-02-161-1/+1
| | | | | | |
* | | | | | | Merge pull request #16491 from akshay-vishnoi/doc-changesYves Senn2014-08-131-2/+2
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | [ci skip] fix spelling of overridden
| * | | | | | | [ci skip] fix spelling of overrideAkshay Vishnoi2014-08-131-2/+2
| | |_|/ / / / | |/| | | | |
* | | | | | | Merge pull request #16489 from tomkadwill/updating_options_to_new_styleYves Senn2014-08-131-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | [ci skip] Updated where scope documentation to conform to new style
| * | | | | | | [ci skip] Updated where scope to conform to new styleTom Kadwill2014-08-131-1/+1
| |/ / / / / /
* / / / / / / `index_exists?` with `:name` checks specified columns.Yves Senn2014-08-131-7/+8
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Yves Senn & Matthew Draper] The column check was embodied in the defaul index name. If the :name option was used, the specified columns were not verified at all. Given: ``` assert connection.index_exists?(table_name, :foo_id, :name => :index_testings_on_yo_momma) ``` That index could have been defined on any field, not necessarily on `:foo_id`.
* | | / / / update error message to reflect that the record could have been destroyedlsylvester2014-08-111-1/+2
| |_|/ / / |/| | | |
* | | | | Merge pull request #16441 from ↵Santiago Pastorino2014-08-091-4/+4
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | tomkadwill/activerecord_associations_options_param [ci skip] Changed options to +options+ for rdoc
| * | | | | [ci skip] Changed options to +options+ for rdocTom Kadwill2014-08-091-4/+4
| | |_|/ / | |/| | |
* / | | | Using delegated connection methodJoshua Delsman2014-08-081-1/+1
|/ / / /
* | | | [ci skip] Changed 'first argument' to '+name+ argument'Tom Kadwill2014-08-081-4/+4
| | | |
* | | | Rephrase how we explain RecordInvalid exception in the context ofZachary Scott2014-08-071-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | `#create!` regarding validations in contrast to the behavior of `#create`. Also describe creating multiple objects using an array of hashes as the +attributes+ parameter. [ci skip] /cc #16384
* | | | Merge pull request #16384 from tomkadwill/improved_create_documentationZachary Scott2014-08-071-2/+5
|\ \ \ \ | | | | | | | | | | [ci skip] Added +object+ and +attributes+ to create! description for rdoc
| * | | | [ci skip] Updated create! documentation description and added +attributes+ ↵Tom Kadwill2014-08-071-2/+5
| | | | | | | | | | | | | | | | | | | | for rdoc
* | | | | use the uri parser so that newer version of Ruby workAaron Patterson2014-08-071-1/+1
| | | | |
* | | | | change to empty? from blank?tsukasaoishi2014-08-081-1/+1
| | | | |
* | | | | Tables existence check query is executed in large quantitiestsukasaoishi2014-08-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Rails starts, tables existence check query is executed number of models. In case of mysql, SHOW TABLES LIKE 'table1'; SHOW TABLES LIKE 'table2'; SHOW TABLES LIKE 'table3'; ... SHOW TABLES LIKE 'table999'; Add process to get the names of all tables by one query.
* | | | | Define id_was to get the previous value of the primary keyRafael Mendonça França2014-08-061-1/+7
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when we call id_was and we have a custom primary key name Active Record will return the current value of the primary key. This make impossible to correctly do an update operation if you change the id. Fixes #16413
* | | | schema rake tasks are specific about the configuration to act on.Yves Senn2014-08-063-14/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rake tasks and the `DatabaseTakss` adapter classes used to assume a configuration at some places. This forced the rake tasks to establish a specific connection before calling into `load_schema`. After #15394 this started to cause issues because it could `purge` the wrong database before loading the schema.
* | | | Revert "Revert "Merge pull request #15394 from ↵Yves Senn2014-08-062-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | morgoth/fix-automatic-maintaining-test-schema-for-sql-format"" This reverts commit 5c87b5c5248154cf8aa76cce9a24a88769de022d.
* | | | Merge pull request #16364 from arthurnn/make_transaction_one_classJeremy Kemper2014-08-051-70/+54
|\ \ \ \ | | | | | | | | | | Clarify Transaction responsibilities by breaking unneeded inheritance hierarchy.
| * | | | Cleanup Transaction inheritance.Arthur Neves2014-08-051-70/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Transaction class doesnt need to encapsulate the transaction state using inheritance. This removes all Transaction subclasses, and let the Transaction object controls different actions based on its own state. Basically the only actions would behave differently are `being`,`commit`,`rollback` as they could act in a savepoint or in a real transaction.