aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
Commit message (Collapse)AuthorAgeFilesLines
* Allow YAML serialization when using TZ aware attributesSean Griffin2014-09-174-3/+20
|
* do not dump foreign keys for ignored tables.Yves Senn2014-09-171-1/+1
|
* pg, correctly dump foreign keys targeting tables in a different schema.Yves Senn2014-09-171-1/+2
| | | | | | Closes #16907. [Matthew Draper & Yves Senn]
* Merge pull request #13656 from chanks/rollback_transactions_in_killed_threadsMatthew Draper2014-09-141-5/+11
|\ | | | | | | Data corruption risk: Roll back open transactions when the running thread is killed.
| * Roll back open transactions when the running thread is killed.Chris Hanks2014-08-221-1/+5
| |
* | Merge pull request #16669 from aantix/dangerous_attribute_error_better_messageRafael Mendonça França2014-09-121-1/+1
|\ \ | | | | | | Improved the error messaging for the DangerousAttributeError exception
| * | Changed the DangerousAttributeError exception message to include messaging ↵Jim Jones2014-09-101-1/+1
| | | | | | | | | | | | that the conflict could be because of a conflicting attribute.
* | | A `NullRelation` should represent nothing. Closes #15176.Yves Senn2014-09-111-2/+2
|/ / | | | | | | | | | | [Matthew Draper & Yves Senn] Closes #16860. (pull request to discuss the implementation)
* | Include default column limits in schema.rbJeremy Kemper2014-09-101-4/+8
| | | | | | | | | | | | Allows :limit defaults to be changed without pulling the rug out from under old migrations that omitted :limit because it matched the default at the time.
* | MySQL: schema.rb now includes TEXT and BLOB column limits.Jeremy Kemper2014-09-101-4/+7
| |
* | MySQL: correct LONGTEXT and LONGBLOB limits from 2GB to their true 4GBJeremy Kemper2014-09-101-2/+2
| |
* | Merge pull request #16379 from JackDanger/update-preloader-documentationRafael Mendonça França2014-09-101-23/+32
|\ \ | | | | | | Updating Associations::Preloader docs
| * | Updating Associations::Preloader docsJack Danger Canty2014-08-171-23/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | Much of the previous documentation introduced features new in 2011. This commit refreshes it to provide clearer code examples and spends more time describing the normal case (preloaded associations) and less time describing the fallback. [ci skip]
* | | Merge pull request #14056 from girishso/14041Yves Senn2014-09-091-1/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | SQLite3Adapter now checks for views in table_exists? fixes: 14041 Conflicts: activerecord/CHANGELOG.md
| * | | SQLite3Adapter now checks for views in table_exists? fixes: 14041Girish S2014-02-141-1/+1
| | | |
* | | | introduce `connection.supports_views?` and basic view tests.Yves Senn2014-09-094-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `AbstractAdapter#supports_views?` defaults to `false` so we have to turn it on in adapter subclasses. Currently the flag only controls test execution. /cc @yahonda
* | | | Allow included modules to override association methods.Yves Senn2014-09-092-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #16684. This is achieved by always generating `GeneratedAssociationMethods` when `ActiveRecord::Base` is subclassed. When some of the included modules of `ActiveRecord::Base` were reordered this behavior was broken as `Core#initialize_generated_modules` was no longer called. Meaning that the module was generated on first access.
* | | | Merge pull request #16825 from cristianbica/fix-ar-nested-arraysMatthew Draper2014-09-081-4/+12
|\ \ \ \ | | | | | | | | | | Fix query with nested array in Active Record
| * | | | Fix query with nested array in Active RecordCristian Bica2014-09-061-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `User.where(id: [[1,2],3])` was equal to `User.where(id:[1, 2, 3])` in Rails 4.1.x but because of some refactoring in Arel this stopped working in 4.2.0. This fixes it in Rails. [Dan Olson & Cristian Bica]
* | | | | Schema dumper: all connection adapters implement #primary_key, so rely on it ↵Jeremy Kemper2014-09-071-10/+1
| | | | | | | | | | | | | | | | | | | | exclusively
* | | | | Fix warnings for undefined local variableTee Parham2014-09-071-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | * Add private method primary_key_for, which more clearly shows that the expected return value is nil when a primary key is not found.
* | | | | Prefer "if any?" to "unless empty?"Tee Parham2014-09-071-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | * Consistent whitespace * Remove unnecessary parentheses
* | | | | Convert string concatenations to substitutionsTee Parham2014-09-071-15/+15
|/ / / /
* | | | Do not mark object as persisted after an association is savedRafael Mendonça França2014-09-051-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Callback order in Active Record objects are important. Users should not define callbacks before the association definition or surprising behaviours like the described at #3798 will happen. This callback order dependency is documented at https://github.com/rails/rails/blob/31bfcdc77ca0d8cec9b5fe513bdc6f05814dd4f1/activerecord/lib/active_record/associations.rb#L1222-1227. This reverts #15728. Fixes #16620.
* | | | Freeze ADAPTER_NAME in adaptersAbdelkader Boudih2014-09-056-17/+6
| | | |
* | | | Fixed regression with referencing polymorphic assoc in eager-loadGodfrey Chan2014-09-052-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is cased by 03118bc + 9b5d603. The first commit referenced the undefined local variable `column` when it should be using `reflection.type` as the lookup key. The second commit changed `build_arel` to not modify the `bind_values` in- place so we need to combine the arel's `bind_values` with the relation's when building the SQL. Fixes #16591 Related #15821 / #15892 / 7aeca50
* | | | Merge pull request #16788 from codeodor/fix-16761Aaron Patterson2014-09-043-2/+3
|\ \ \ \ | | | | | | | | | | Skip StatementCache for eager loaded associations
| * | | | Skip StatementCache for eager loaded associations (Fixes #16761)Sammy Larbi2014-09-043-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Eagerly loaded collection and singular associations are ignored by the StatementCache, which causes errors when the queries they generate reference columns that were not eagerly loaded. This commit skips the creation of the StatementCache as a fix for these scenarios.
* | | | | always reorder bind parameters. fixes #15920Aaron Patterson2014-09-041-6/+4
|/ / / /
* | | | Merge pull request #16801 from ↵Rafael Mendonça França2014-09-042-7/+6
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | eileencodes/refactor-scope_chain-on-through-refelction-to-eliminate-branch-in-eval_scope Always add lambda to scope chain to eliminate branch in eval_scope
| * | | | Always add lambda to scope chain to eliminate branch in eval_scopeeileencodes2014-09-042-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We convert all other scopes to lambda's so it makes sense that we should always returns a lambda on a ThroughReflection as well. This eliminates the need to check if the scope is a Relation.
* | | | | Follup to PR #16762eileencodes2014-09-041-4/+4
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove chain from parameters, it's no longer needed since chain and i are being passed via next_reflection Change name of `reflection` to `owner_reflection` because of shadow variable warning. The last reflection will always be the owner.
* | | | Enums shouldn't ruin people's anniversariesGodfrey Chan2014-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a few more methods on Module/Class to the dangerous class methods blacklist. (Technically, allocate and new are already protected currently because we happen to redefine them in the current implantation.) Closes #16792
* | | | get rid of shadowing warning when running tests AR and railtie tests.Yves Senn2014-09-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Warning looked like this: ``` /Users/senny/Projects/rails/activerecord/lib/active_record/associations/association_scope.rb:142: warning: shadowing outer local variable - reflection ```
* | | | extract updating all fixture cache to a method so we can lock laterAaron Patterson2014-09-031-1/+5
| | | |
* | | | schema loading rake tasks maintain database connection for current env.Yves Senn2014-09-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Joshua Cody & Yves Senn] Closes #16757. Prior to this patch schema loading rake tasks had the potential to leak a connection to a different database. This had side-effects when rake tasks operating on the current connection (like `db:seed`) were chained.
* | | | Merge pull request #16781 from kamipo/move_column_option_handlingYves Senn2014-09-032-6/+3
|\ \ \ \ | | | | | | | | | | Move column option handling to new_column_definition
| * | | | Move column option handling to new_column_definitionRyuta Kamizono2014-09-032-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | TableDefinition#column is not called from `add_column`. Use TableDefinition#new_column_definition for column option handling.
* | | | | Merge pull request #16762 from ↵Aaron Patterson2014-09-021-35/+52
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | eileencodes/refactor-add_constraints-complex-loop-conditional Refactor add_constraints complex loop conditional
| * | | | | Break conditional branches into separate methodseileencodes2014-09-011-35/+52
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This breaks the two branches of the `if reflection.last` and `else` to clearer see where the two methods can be refactored. Eventually we hope to remove the need for these separated methods altogether. Move the first branch outside the loop This code doesn't need to be in the loop because it it always affects the last chain. `get_bind_values` and `add_constraints` must match in this context because `get_bind_values` is the caching of `add_constraints` Use each_cons to remove need for `chain[i + 1]` The `chain[i + 1]` is confusing because it's not immediately obvious what it's trying to achieve. The use of `each_cons` makes it clear we need to get the `next_reflection`.
* / / / / Add and Remove string/strip requireArthur Neves2014-09-023-1/+3
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | Method .strip_heredoc is defined in active_support/core_ext/string/strip.rb so we need to require it. [fixes #16677]
* | | | Merge pull request #16704 from ankit1910/use-existing-methodRafael Mendonça França2014-09-011-1/+1
|\ \ \ \ | | | | | | | | | | use self instead of #read_attribute
| * | | | use self instead of #read_attributeankit19102014-08-261-1/+1
| | | | |
* | | | | MySQL: set connection collation along with the charsetJeremy Kemper2014-08-301-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sets the connection collation to the database collation configured in database.yml. Otherwise, `SET NAMES utf8mb4` will use the default collation for that charset (utf8mb4_general_ci) when you may have chosen a different collation, like utf8mb4_unicode_ci. This only applies to literal string comparisons, not column values, so it is unlikely to affect you.
* | | | | Refer to the library name instead of the constantRobin Dupret2014-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we are loading a component and we want to know its version, we are actually not speaking about the constant but the library itself. [ci skip] [Godfrey Chan & Xavier Noria]
* | | | | Forgot to set Migration.verbose at f8d9a51949d6f6cfcab7cc7d501e137836eb88dc ↵Akira Matsuda2014-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | :bomb:
* | | | | Merge branch 'master' of github.com:rails/railsDavid Heinemeier Hansson2014-08-2921-110/+201
|\ \ \ \ \
| * | | | | Don't allow AR::Tasks::DatabaseTasks.migrate to mutate Migration.verbose valueAkira Matsuda2014-08-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | This fixes random test failure in migrator_test.rb
| * | | | | [ci skip] Fix example code of ActiveRecord::FixtureSet.context_classyuuji.yaginuma2014-08-291-1/+1
| | | | | |
| * | | | | Avoid using heredoc for user warningsGodfrey Chan2014-08-2810-61/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using heredoc would enforce line wrapping to whatever column width we decided to use in the code, making it difficult for the users to read on some consoles. This does make the source code read slightly worse and a bit more error-prone, but this seems like a fair price to pay since the primary purpose for these messages are for the users to read and the code will not stick around for too long.