aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | 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
| |/ /
* | | Merge pull request #11694 from ↵Rafael Mendonça França2014-11-101-0/+7
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | Empact/association-bind-values-not-updated-on-save Fix that a collection proxy could be cached before the save of the owner, resulting in an invalid proxy lacking the owner’s id Conflicts: activerecord/CHANGELOG.md
| * | Fix that a collection proxy could be cached before the save of the owner, ↵Ben Woosley2014-10-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | resulting in an invalid proxy lacking the owner’s id. Absent this fix calls like: owner.association.update_all to behave unexpectedly because they try to act on association objects where owner_id is null. more evidence here: https://gist.github.com/Empact/5865555 ``` Active Record 3.2.13 -- create_table(:firms, {:force=>true}) -> 0.1371s -- create_table(:clients, {:force=>true}) -> 0.0005s 1 clients. 1 expected. 1 clients updated. 1 expected. ``` ``` Active Record 4.0.0 -- create_table(:firms, {:force=>true}) -> 0.1606s -- create_table(:clients, {:force=>true}) -> 0.0004s 1 clients. 1 expected. 0 clients updated. 1 expected. ```
* | | Revert the behavior of booleans in string columns to that of 4.1Sean Griffin2014-11-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why are people assigning booleans to string columns? >_> We unintentionally changed the behavior on Sqlite3 and PostgreSQL. Boolean values should cast to the database's representation of true and false. This is 't' and 'f' by default, and "1" and "0" on Mysql. The implementation to make the connection adapter specific behavior is hacky at best, and should be re-visted once we decide how we actually want to separate the concerns related to things that should change based on the database adapter. That said, this isn't something I'd expect to change based on my database adapter. We're storing a string, so the way the database represents a boolean should be irrelevant. It also seems strange for us to give booleans special behavior at all in string columns. Why is `to_s` not sufficient? It's inconsistent and confusing. Perhaps we should consider deprecating in the future. Fixes #17571
* | | Ensure HABTM relationships produce valid class names (Fixes #17119)Sammy Larbi2014-11-091-1/+10
| | |
* | | default scopes should break the cache on singulur_association.alfa-jpn2014-11-081-0/+29
| | | | | | | | | | | | fixes #17495
* | | default scopes should break the cache on has_many.Aaron Patterson2014-11-071-0/+26
| | | | | | | | | | | | | | | | | | if you specify a default scope on a model, it will break caching. We cannot predict what will happen inside the scope, so play it safe for now. fixes #17495
* | | pg tests, get rid of `sql_types_test.rb`.Yves Senn2014-11-073-18/+14
| | |
* | | pg tests, only execute what's necessary.Yves Senn2014-11-072-27/+26
| | |
* | | Merge pull request #17541 from OpenSourceProjects/meaninful_messageYves Senn2014-11-071-3/+9
|\ \ \ | | | | | | | | | | | | Print out a meaningful error when ActiveRecord::ReadOnlyRecord is raised
| * | | Print out a meaningful error when ActiveRecord::ReadOnlyRecord is raisedFranky W2014-11-061-3/+6
|/ / / | | | | | | | | | | | | | | | | | | Currently, there is no messages which get printed out. Convoluted system may have hooks that create other objects in which case we only fail with no messages. This commit changes this information allowing you to know which object is the one that actually raised the error.
* | | tests, remove unneeded requires.Yves Senn2014-11-064-11/+0
| | |
* | | tests, use SchemaDumpingHelper to dump a specific table.Yves Senn2014-11-061-12/+12
| | | | | | | | | | | | | | | This makes debugging the generated schema output much easier. As a side effect it also shaves off 2.5 seconds of test runtime.
* | | Merge pull request #17360 from bronzle/includes_and_unscopedYves Senn2014-11-051-0/+8
|\ \ \ | | | | | | | | | | | | copy reflection_scopes’s unscoped value when building scope for preloading
| * | | copy reflection_scopes’s unscoped value when building scope for ↵Byron Bischoff2014-10-221-0/+8
| | | | | | | | | | | | | | | | preloading, fixes #11036
* | | | Added SchemaDumper support for tables with jsonb columns.Ted O'Meara2014-11-042-7/+8
| | | |
* | | | Add an `assert_deprecated` for `sanitize_sql_hash_for_conditions`Sean Griffin2014-11-021-1/+3
| | | |
* | | | Handle `RangeError` from casting in `find_by` and `find_by!` on RelationSean Griffin2014-11-021-0/+10
| |_|/ |/| | | | | | | | | | | We should not behave differently just because a class has a default scope.
* | | Add a test case for range type castingSean Griffin2014-11-011-0/+4
| | | | | | | | | | | | | | | We support this behavior, but have no tests which assert that type casting actually occurs.
* | | Fix test which failed in isolationSean Griffin2014-11-011-0/+1
| | | | | | | | | | | | It was transitively relying on the vertex model being loaded
* | | Use bind values for joined tables in where statementsSean Griffin2014-11-011-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In practical terms, this allows serialized columns and tz aware columns to be used in wheres that go through joins, where they previously would not behave correctly. Internally, this removes 1/3 of the cases where we rely on Arel to perform type casting for us. There were two non-obvious changes required for this. `update_all` on relation was merging its bind values with arel's in the wrong order. Additionally, through associations were assuming there would be no bind parameters in the preloader (presumably because the where would always be part of a join) [Melanie Gilman & Sean Griffin]
* | | fix set_pk_sequence and add a test for it.Aaron Patterson2014-10-311-0/+8
| | |