aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
Commit message (Collapse)AuthorAgeFilesLines
* Override #find_by! in core to enable AST cachingGodfrey Chan2014-08-251-0/+4
|
* Fixed find_by("sql fragment without bindings") on masterGodfrey Chan2014-08-251-1/+1
| | | | | | | | | | | * Also duplicated find_by tests from relations_test.rb to finder_test.rb now that we have a completely different implementation on the class (in core.rb with AST caching stuff). * Also removed a (failing) test that used mocks. Now that we have tests for the behavior, there's no point having another test that tests the implementation (that it delegates). Further, what the test was implying is nolonger true with the current implementation, because Class.find_by is a real method now.
* pg, `default_sequence_name` needs to return a string.Yves Senn2014-08-251-2/+2
| | | | | | | | | This is a reacon to https://github.com/rails/rails/commit/d6c1205584b1ba597db4071b168681678b1e9875#commitcomment-7502487 This backwards incompatibility was introduced with d6c12055 to fix #7516. However both `connection.default_sequence_name` and `model.sequence_name` are public API. The PostgreSQL adapter should honor the interface and return strings. /cc @matthewd @chancancode
* Fix a few typos [ci skip]Robin Dupret2014-08-241-1/+1
|
* Merge pull request #16675 from tomkadwill/has_many_documenting_extension_paramSantiago Pastorino2014-08-241-0/+14
|\ | | | | [ci skip] Added documentation for has_many extension parameter
| * [ci skip] Added documentation for has_many extension parameterTom Kadwill2014-08-241-0/+14
| |
* | CHANGELOG & improvements to #16649Godfrey Chan2014-08-231-2/+2
| | | | | | | | | | * Require either FIRST or LAST qualifier for "NULLS ..." * Require whitespace before "NULLS ..."
* | Don't trim excess whitespace in pg #columns_for_distinctAgis-2014-08-241-1/+2
| | | | | | | | Fixes #16623 introduced by https://github.com/rails/rails/commit/3d5a2019bcccc6fb01bee4811ca669f4383edb51
* | Merge pull request #15932 from joseluistorres/issue-11957-uuidsRafael Mendonça França2014-08-221-0/+2
|\ \ | | | | | | adding the exception RecordNotFound to UUID find #11957
| * | adding the exception RecordNotFound to UUID findJoseLuis Torres2014-08-211-0/+2
| | |
* | | Don't calculate in-place changes twiceSean Griffin2014-08-221-8/+0
| |/ |/| | | | | | | | | Now that `changed_attributes` includes in place changes, we don't need to override these methods in Active Record. Partially fixes the performance regression caused by #16189
* | [ci skip] Added documentation for has_and_belongs_to_many scope parameterTom Kadwill2014-08-221-0/+12
| |
* | Merge pull request #16204 from jonatack/patch-7Vijay Dev2014-08-211-12/+14
|\ \ | | | | | | Fix minor typos and improve grammar and code formatting
| * | Grammar passJon Atack2014-08-191-12/+14
| | | | | | | | | | | | | | | | | | [ci skip] Add improvements from @eileencodes [skip ci]
* | | [ci skip] Added documentation for has_one scope parameterTom Kadwill2014-08-211-0/+11
| |/ |/|
* | Merge pull request #16593 from aditya-kapoor/add-doc-for-stepZachary Scott2014-08-201-3/+6
|\ \ | | | | | | [ci skip] add doc for STEP in migration
| * | [ci skip] add doc for STEP in migrationAditya Kapoor2014-08-211-3/+6
| | |
* | | Merge pull request #16575 from tomkadwill/added_has_many_scope_documentationZachary Scott2014-08-201-0/+11
|\ \ \ | |/ / |/| | [ci skip] Added documentation for has_many scope parameter
| * | [ci skip] Added documentation for has_many scope parameterTom Kadwill2014-08-201-0/+11
| | |
* | | [ci skip] correct docs about the migration generationAditya Kapoor2014-08-211-9/+2
| | |
* | | Merge pull request #16172 from Agis-/hmt_scope_arityRafael Mendonça França2014-08-201-1/+5
|\ \ \ | | | | | | | | has_many :through with dynamic condition merging
| * | | Only merge scopes with zero arity in has_many throughAgis-2014-08-201-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with dynamic conditions. Fixes #16128 This bug was introduced in https://github.com/rails/rails/commit/c35e438620f2d56562251571377995359546393d so it's present from 4.1.2-rc1 and after. https://github.com/rails/rails/commit/c35e438620f2d56562251571377995359546393d merges any relation scopes passed as proc objects to the relation, but does *not* take into account the arity of the lambda. To reproduce: https://gist.github.com/Agis-/5f1f0d664d2cd08dfb9b
* | | | Merge pull request #16145 from phoet/patch-2Rafael Mendonça França2014-08-201-5/+5
|\ \ \ \ | |_|/ / |/| | | don't log errors when all is fine
| * | | don't log errors when all is finePeter Schröder2014-07-171-5/+5
| | | |
* | | | [ci skip] "..enables interrorgating of [thing].." would be correctZachary Scott2014-08-191-1/+1
| |/ / |/| |
* | | Merge pull request #16475 from tomkadwill/has_many_scope_documentationZachary Scott2014-08-191-0/+11
|\ \ \ | | | | | | | | [ci skip] Added documentation for belongs_to scope parameter
| * | | [ci skip] Added documentation for belongs_to scope parameterTom Kadwill2014-08-191-0/+11
| | | |
* | | | Merge pull request #16349 from jmcnevin/masterRafael Mendonça França2014-08-191-9/+8
|\ \ \ \ | | | | | | | | | | Correctly determine if migration is needed.
| * | | | Correctly determine if migration is needed.Jeremy McNevin2014-08-131-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This method would assume that if last migration in the migrations directory matched the current schema version, that the database was up to date, but this does not account for new migrations with older timestamps that may be pending.
* | | | | Add missing AS requireArthur Neves2014-08-191-0/+1
| | | | | | | | | | | | | | | | | | | | `strip_heredoc` method is defined on active_support/core_ext/string
* | | | | Merge pull request #16542 from ↵Rafael Mendonça França2014-08-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | seamusabshere/numerify-pool-checkout-timeout-from-urls-4-1-stable Make sure :checkout_timeout and :dead_connection_timeout are numbers Conflicts: activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
* | | | | Remove to_s from reflection.type in add_constraintseileencodes2014-08-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The instance var is already saved as a string in the initialization method of AssociationReflection. See https://github.com/rails/rails/blob/master/activerecord/lib/active_record/reflection.rb#L273
* | | | | 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 #16481 from sgrif/sg-change-default-timestampsDavid Heinemeier Hansson2014-08-173-8/+26
|\ \ \ \ \ \ | | | | | | | | | | | | | | Change the default `null` value for timestamps
| * | | | | | Change the default `null` value for timestampsSean Griffin2014-08-123-8/+26
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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