aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | Refactor `build_from_hash` to convert dot notation to hash firstMelanie Gilman2014-12-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that we're handling all forms of nested tables the same way. We're aware that the `convert_dot_notation_to_hash` method will cause a performance hit, and we intend to come back to it once we've refactored some of the surrounding code. [Melissa Xie & Melanie Gilman]
* | | | | Allow to unscope where conditions using `arel_table` with Symboldeeeki2014-12-031-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes the following case. User.where(User.arel_table[:created_at].lteq(1.year.ago)).unscope(where :created_at)
* | | | | pg tests, get rid of global schema `schema_1`.Yves Senn2014-12-022-46/+51
| | | | |
* | | | | pg tests, move uniqueness validation test to array tests.Yves Senn2014-12-022-17/+15
| | | | |
* | | | | tests, extract pg number tests into separate file.Yves Senn2014-12-022-35/+50
| | | | |
* | | | | tests, move schema shorthand assertions into pg specific tests.Yves Senn2014-12-029-76/+86
| | | | |
* | | | | tests, move pg geometric tests out of `base_test`.Yves Senn2014-12-022-93/+73
| | | | |
* | | | | ugh, forgot to add this test to cdd90f39d796986dabf1678b3277b230dbe18961Aaron Patterson2014-12-011-0/+5
| | | | |
* | | | | tests, favor public API over inspecting columns where possible.Yves Senn2014-12-011-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | This is a follow up to https://github.com/rails/rails/commit/07786c5e75a7b0afdf318063510af6b475e3e04c and https://github.com/rails/rails/commit/cd2596f55e88fe659592612a793c4f4aa723c9be
* | | | | tests, run numeric default tests for every adapter.Yves Senn2014-12-011-15/+33
| | | | |
* | | | | tests, use public API to verify default parsing. #17863, #17856Yves Senn2014-12-011-1/+2
| | | | |
* | | | | Fix value extracted from negative integers for PostgreSQL.Guo Xiang Tan2014-12-011-0/+4
| | | | | | | | | | | | | | | | | | | | Fixes: https://github.com/rails/rails/issues/17856.
* | | | | Ensure numericality validations work with mutationSean Griffin2014-12-011-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The detection of in-place changes caused a weird unexpected issue with numericality validations. That validator (out of necessity) works on the `_before_type_cast` version of the attribute, since on an `:integer` type column, a non-numeric string would type cast to 0. However, strings are mutable, and we changed strings to ensure that the post type cast version of the attribute was a different instance than the before type cast version (so the mutation detection can work properly). Even though strings are the only mutable type for which a numericality validation makes sense, special casing strings would feel like a strange change to make here. Instead, we can make the assumption that for all mutable types, we should work on the post-type-cast version of the attribute, since all cases which would return 0 for non-numeric strings are immutable. Fixes #17852
* | | | | Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-2930-121/+109
| | | | |
* | | | | Adds preloaded_records method to NullPreloaderThorsten Ball2014-11-281-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression where preloading association throws an exception if one of the associations in the preloading hash doesn't exist for one record. Fixes #16070
* | | | | Fix a bug where AR::RecordNotSaved loses error messagesYuki Nishijima2014-11-273-9/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 3e30c5d, it started ignoring the given error message. This commit changes the behavior of AR::RecordNotSaved#initialize so that it no longer loses the given error message.
* | | | | Merge pull request #17807 from jvperrin/correct-integer-testRafael Mendonça França2014-11-271-1/+1
|\ \ \ \ \ | |_|_|/ / |/| | | | Correct test description for large integer test
| * | | | Correct test description for large integer testJason Perrin2014-11-031-1/+1
| | | | |
* | | | | Merge pull request #17674 from recursive-madman/activerecord-error-improvementRafael Mendonça França2014-11-261-2/+4
|\ \ \ \ \ | | | | | | | | | | | | Add #record attribute to RecordNotFound and RecordDestroyed exceptions.
| * | | | | Add #record attribute to RecordNotFound and RecordDestroyed exceptions.Recursive Madman2014-11-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | This allows these exceptions to be handled generically in conjunction with RecordInvalid.
* | | | | | Merge pull request #17697 from sgrif/sg-remove-is-a-check-when-ignoring-tablesSean Griffin2014-11-251-10/+0
|\ \ \ \ \ \ | | | | | | | | | | | | | | Remove is_a? check when ignoring tables
| * | | | | | Remove is_a? check when ignoring tablesSean Griffin2014-11-201-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Technically changes the API, as it will allow any object which responds to `===`. Personally, I think this is more flexible.
* | | | | | | Setting an association replaces records with the same id in memorySean Griffin2014-11-251-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The records weren't being replaced since equality in Active Record is defined in terms of `id` only. It is reasonable to expect that the references would be replaced in memory, even if no queries are actually executed. This change did not appear to affect any other parts of the code base. I chose not to execute callbacks since we're not actually modifying the association in a way that will be persisted. Fixes #17730
* | | | | | | oops, forgot to add the real assertion!Aaron Patterson2014-11-241-0/+1
| | | | | | |
* | | | | | | allow the "USING" statement to be specified on change column callsAaron Patterson2014-11-241-0/+25
| | | | | | |
* | | | | | | Merge pull request #17678 from siddharth28/includes_with_scope_with_joinsSantiago Pastorino2014-11-241-0/+6
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix includes on association with a scope
| * | | | | | | Fix includes on association with a scope containing joins along with conditionssiddharth@vinsol.com2014-11-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on the joined assoiciation
* | | | | | | | Add a test for reflection keys as Strings, fixes #16928Zachary Scott2014-11-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See also PR: #17610
* | | | | | | | Rename the primary key index when renaming a table in pgSean Griffin2014-11-221-0/+34
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also checked to make sure this does not affect foreign key constraints. (It doesn't). Fixes #12856 Closes #14088
* | | | | | | make it possible to access fixtures excluded by a `default_scope`.Yves Senn2014-11-211-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this patch you'd end up with an error like: ``` ActiveRecord::RecordNotFound: Couldn't find <Model> with 'id'=<id> [WHERE (<default_scope condition>)] ```
* | | | | | | raise a better exception for renaming long indexesAaron Patterson2014-11-201-0/+14
| | | | | | |
* | | | | | | synchronize code and docs for `timestamps` and `add_timestamps`.Yves Senn2014-11-203-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the following changes: * warn if `:null` is not passed to `add_timestamps` * `timestamps` method docs link to `add_timestamps` docs * explain where additional options go * adjust examples to include `null: false` (to prevent deprecation warnings)
* | | | | | | Merge pull request #17575 from shikshachauhan/make-habtm-consistentRafael Mendonça França2014-11-191-0/+10
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | Allow class_name option in habtm to be consistent with other association...
| * | | | | | Allow habtm class_name option to be consistent with other associationsshiksha2014-11-131-0/+10
| | | | | | |
* | | | | | | Reintroduce cache with testsSean Griffin2014-11-191-0/+32
| | | | | | |
* | | | | | | Add tests for `TypeMap#fetch` and push up to `TypeMap`Sean Griffin2014-11-191-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It doesn't make sense for the subclass to implement this method, and not have it on the parent. We can also DRY up the implementation of `#lookup` to be defined in terms of fetch, which will give us a single point of entry
* | | | | | | That last test was incorrect... ☕Sean Griffin2014-11-191-10/+0
| | | | | | |
* | | | | | | Introduce test to demonstrate regression caused by da99a2a2Sean Griffin2014-11-191-0/+10
| | | | | | |
* | | | | | | Merge pull request #17662 from ↵Rafael Mendonça França2014-11-191-0/+8
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | | | | | | | | | | | | | | | dtaniwaki/support-symbol-foreign-key-column-to-delete Support symbol foreign key to delete
| * | | | | | Support symbol foreign key to deletedtaniwaki2014-11-191-0/+8
| | | | | | |
* | | | | | | Improve the performance of reading attributesSean Griffin2014-11-181-1/+1
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We added a comparison to "id", and call to `self.class.primary_key` a *lot*. We also have performance hits from `&block` all over the place. We skip the check in a new method, in order to avoid breaking the behavior of `read_attribute`
* | | | | | Remove the unused second argument to `substitute_at`Sean Griffin2014-11-174-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Oh hey, we got to remove some code because of that!
* | | | | | rm `reorder_bind_params`Sean Griffin2014-11-175-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Arel handles this for us automatically. Updated tests, as BindParam is no longer a subclass of SqlLiteral. We should remove the second argument to substitute_at entirely, as it's no longer used
* | | | | | Force table creation in testsSean Griffin2014-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If something causes the teardown block to not get run (errors, interrupting test runs), we have to manually delete them, which is a pain.
* | | | | | Correctly determine if an attribute is uninitializedSean Griffin2014-11-141-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In real usage, we give the builder a types hash with a default value of `Type::Value.new`. This means we need to explicitly check for the key, rather than the truthiness of the type to determine if it's a known but uninitialized attribute
* | | | | | Reduce the amount of work performed when instantiating AR modelsSean Griffin2014-11-141-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't know which attributes will or won't be used, and we don't want to create massive bottlenecks at instantiation. Rather than doing *any* iteration over types and values, we can lazily instantiate the object. The lazy attribute hash should not fully implement hash, or subclass hash at any point in the future. It is not meant to be a replacement, but instead implement its own interface which happens to overlap.
* | | | | | Build fix when running in isolationArun Agrawal2014-11-1430-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Computer` class needs to be require See #17217 for more details
* | | | | | add a Table#name accessor like TableDefinition#nameCody Cutrer2014-11-101-0/+6
| | | | | |
* | | | | | Merge pull request #17578 from codeodor/fix-17217-test-bugRafael Mendonça França2014-11-101-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix bug found when running individual tests against #17217 after merging
| * | | | | | Fixes a bug found when running individual tests against #17217 after mergingSammy Larbi2014-11-101-1/+1
| |/ / / / /