aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | Merge pull request #20552 from jamesdabbs/belongs-to-polymorphic-force-reloadYves Senn2015-06-233-1/+10
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Fix `undefined method uncached` for polymorphic belongs_to #20426
| * | | | | | | Fix `undefined method uncached` for polymorphic belongs_to #20426James Dabbs2015-06-132-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unitialized polymorphic `belongs_to` associations raise an error while attempting to reload, as they attempt to make an uncached reload, but don't have a klass to fetch uncachedly. In this case, `loaded?` should be `false` anyway.
* | | | | | | | Merge pull request #20545 from dcrec1/20541Yves Senn2015-06-233-3/+39
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | | | | | | | | | | thrown ActiveRecord::AssociationTypeMismatch when assigning a wrong value for a namespaced association
| * | | | | | | thrown ActiveRecord::AssociationTypeMismatch when assigning a wrong value ↵Diego Carrion2015-06-223-3/+31
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | for a namespaced association fixes #20541
* | | | | | | refactor, don't duplicate presence validator logic.Yves Senn2015-06-221-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a small refactoring that simplifies the Active Record specific lenght validator.
* | | | | | | docs, update Active Model reference for AR length validator. [ci skip]Yves Senn2015-06-221-1/+4
| | | | | | |
* | | | | | | AR absence validator respects `marked_for_destruction?`. Closes #20449.Yves Senn2015-06-224-0/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Associated objects that were marked for destruction are considered absent.
* | | | | | | Merge pull request #20636 from dcrec1/isolated_testYves Senn2015-06-201-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | fix test not failing when executed isolated
| * | | | | | | fix test not failing when executed isolatedDiego Carrion2015-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the test was created in 7659fb6 the fixtures were added in c092dbe
* | | | | | | | Include `Enumerable` in `ActiveRecord::Relation`Sean Griffin2015-06-195-37/+21
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After discussing, we've decided it makes more sense to include it. We're already forwarding every conflicting method to `to_a`, and there's no conflation of concerns. `Enumerable` has no mutating methods, and it just allows us to simplify the code. No existing methods will have a change in behavior. Un-overridden Enumerable methods will simply delegate to `each`. [Sean Griffin & bogdan]
* | | | | | | Use `Enumerable#sum` on `ActiveRecord::Relation` when a block is givenSean Griffin2015-06-193-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This matches our behavior in other cases where useful enumerable methods might have a different definition in `Relation`. Wanting to actually enumerate over the records in this case is completely reasonable, and wanting `.sum` is reasonable for the same reason it is on `Enumerable` in the first place.
* | | | | | | Merge pull request #20259 from rastasheep/rastasheep-patch-1Yves Senn2015-06-191-2/+2
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Update documentation for ActiveRecord::Migration#remove_index
| * | | | | | | Fix typo [ci skip]Aleksandar Diklic2015-05-221-2/+2
| | |/ / / / / | |/| | | | | | | | | | | | | | | | | | | `remove_index` works with multiple column names as `add_index`
* | | | | | | Merge pull request #19843 from marshall-lee/explain_cte_queriesYves Senn2015-06-193-1/+10
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let WITH (CTE) queries be explainable Conflicts: activerecord/CHANGELOG.md
| * | | | | | | Let WITH (CTE) queries be explainableVladimir Kochnev2015-05-283-1/+10
| | | | | | | |
* | | | | | | | Autoload ActiveRecord::RecordInvalidRafael Mendonça França2015-06-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #20626
* | | | | | | | Fix descriptions of databases.rake [ci skip]Mehmet Emin İNAÇ2015-06-171-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | revert create and drop task descriptions
* | | | | | | | raise ActiveModel::MissingAttributeError when trying to access a ↵Diego Carrion2015-06-162-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | relationship without the foreign key attribute fixes regression reported on #20253 ActiveRecord::Base#[] was not used cause of 8b95420
* | | | | | | | Merge pull request #20572 from arthurnn/db_resetYves Senn2015-06-161-4/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Small refactor on db:reset
| * | | | | | | | Small refactor on db:resetArthur Neves2015-06-151-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | db:reset should not prematurely load the environment, so, for instance, if there is any initializer that touches th DB, it will not touch that before droping it. Also this makes the code simpler. This changed was made back in 15fb4302b6ff16e641b6279a3530eb8ed97f2899 , not sure why. But I am pretty much sure we should do it like this, as drop and setup should load its dependencies tasks if necessary.
* | | | | | | | | Merge pull request #20257 from ↵Arthur Nogueira Neves2015-06-151-0/+6
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | prathamesh-sonpatki/test-for-serial-for-quoted-sequence Added test case for serial? method when sequence name is not quoted
| * | | | | | | | Added test case for serial? method when sequence name is not quotedPrathamesh Sonpatki2015-05-221-0/+6
| | |/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | - Followup of https://github.com/rails/rails/pull/20190/.
* | | | | | | | Merge pull request #20016 from steved/sdavidovitz/abort_if_pendingArthur Nogueira Neves2015-06-151-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | make sure to load_config for db:abort_if_pending_migrations
| * | | | | | | | make sure to load_config for db:abort_if_pending_migrationsSteven Davidovitz2015-05-041-1/+1
| | | | | | | | |
* | | | | | | | | A few documentation edits [ci skip]Robin Dupret2015-06-151-2/+2
| | | | | | | | |
* | | | | | | | | make `remove_index :table, :column` reversible.Yves Senn2015-06-155-14/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This used to raise a `IrreversibleMigration` error (since #10437). However since `remove_index :table, :column` is probably the most basic use-case we should make it reversible again. Conflicts: activerecord/CHANGELOG.md
* | | | | | | | | quick pass over changelogs. [ci skip]Yves Senn2015-06-151-3/+4
| | | | | | | | |
* | | | | | | | | Merge pull request #20550 from maurogeorge/add_reference-rdocYves Senn2015-06-151-0/+3
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add RDoc about add_reference to ActiveRecord::Migration [ci skip]
| * | | | | | | | | Add RDoc about add_reference to ActiveRecord::MigrationMauro George2015-06-131-0/+6
| | |_|_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | | | | [ci skip] fix typo mistakeKuldeep Aggarwal2015-06-141-1/+1
| | | | | | | | |
* | | | | | | | | [ci skip] Fix the dynamic fixtures exampleJeremy Baker2015-06-131-1/+1
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | My impression of the code sample is that the intent is to assign guy_1, guy_2, etc. The code as it stood would have assigned guy_1, guy_1, etc. This simply replaces the 1 with the iterator variable i.
* | | | | | | | [ci skip] Fix the API docs for Bi-directional associationsRoque Pinel2015-06-131-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The examples now take in consideration when Active Record finds inverse associations automatically.
* | | | | | | | Copy-edits in 04c349659bfd97f9eaf5266ef7a64b4eb367c6a8Rafael Mendonça França2015-06-121-1/+2
| | | | | | | |
* | | | | | | | add doc about how empty serialization objects are persisted Diego Carrion2015-06-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | the test case for this commit is in cd3f5db
* | | | | | | | Add a test to ensure `serialize` persists `nil` as `NULL`Sean Griffin2015-06-121-0/+8
| | | | | | | |
* | | | | | | | Don't crash when mutating attributes in a getterSean Griffin2015-06-123-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a getter has side effects on the DB, `changes_applied` will be called twice. The second time will try and remove the changed attributes cache, and will crash because it's already been unset. This also demonstrates that we shouldn't assume that calling getters won't change the value of `changed_attributes`, and we need to clear the cache if an attribute is modified. Fixes #20531.
* | | | | | | | Merge pull request #20480 from senny/test_runnerYves Senn2015-06-1278-223/+246
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | use our own runner for Rails framework components `bin/test`
| * | | | | | | | select the AR adapter through `bin/test`.Yves Senn2015-06-111-0/+16
| | | | | | | | |
| * | | | | | | | make it possible to run AR tests with bin/testYves Senn2015-06-1178-223/+230
| | | | | | | | |
* | | | | | | | | Merge pull request #20226 from EpicH0liday/reversible-remove-foreign-keyYves Senn2015-06-124-2/+50
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make remove_foreign_key reversible Conflicts: activerecord/CHANGELOG.md
| * | | | | | | | | Add an invert method for remove_foreign_keyAster Ryan2015-06-114-2/+51
| | | | | | | | | |
* | | | | | | | | | Add enum prefix/suffix option to enum definitionIgor Kapkov2015-06-126-6/+104
|/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #17511 and #17415
* | | | | | | | | Add a missing test case for the persistence behavior of `serialize`Sean Griffin2015-06-111-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `serialize` makes the contract that if it is given a class name, it will never return something other than an instance of that class. This means that it must cast `nil` to the empty form of that object. As such, we should then persist empty forms of that object as `nil`. While this is techincally under the contract of ``` model.attribute = value assert_equal model.attribute, model.tap(&:save).reload.attribute ``` which we can't actually test universally without property based testing, it has come up more than once and is worth calling out specifically since we aren't looking to change it.
* | | | | | | | | Credit the author of #20515 in the previous commitSean Griffin2015-06-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Sean Griffin & jmondo]
* | | | | | | | | Correctly handle array columns with defaults in the schema dumperSean Griffin2015-06-114-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the subtype provides custom schema dumping behavior, we need to defer to it. We purposely choose not to handle any values other than an array (which technically should only ever be `nil`, but I'd rather code defensively here). Fixes #20515.
* | | | | | | | | Merge pull request #20516 from kares/patch-2Matthew Draper2015-06-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | change AR clear order in ActionDisplatch::Reloader hook
* | | | | | | | | Merge pull request #20497 from dcrec1/masterSean Griffin2015-06-111-2/+1
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | | refactor ActiveRecord's #become by removing not needed code
| * | | | | | | | refactor ActiveRecord's #become by simplifying codeDiego Carrion2015-06-101-2/+1
| | | | | | | | |
* | | | | | | | | Use block variable instead of globalRoque Pinel2015-06-091-2/+2
|/ / / / / / / /
* | | | | | | | Merge pull request #20437 from pwnall/abstract_fixturesRafael Mendonça França2015-06-095-1/+31
|\ \ \ \ \ \ \ \ | |_|_|_|/ / / / |/| | | | | | | Fix crash when loading fixture with belongs_to association defined in abstract base class