aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
Commit message (Collapse)AuthorAgeFilesLines
* Change transaction callbacks to not swallowing errors.Rafael Mendonça França2015-01-042-31/+12
| | | | | | | | Before this change any error raised inside a transaction callback are rescued and printed in the logs. Now these errors are not rescue anymore and just bubble up, as the other callbacks.
* Remove deprecated `sanitize_sql_hash_for_conditions`Rafael Mendonça França2015-01-041-29/+0
|
* Remove deprecated `Reflection#source_macro`Rafael Mendonça França2015-01-041-19/+0
|
* Remove deprecated `symbolized_base_class` and `symbolized_sti_name`Rafael Mendonça França2015-01-041-10/+0
|
* Remove deprecated `ActiveRecord::Fixtures` constantRafael Mendonça França2015-01-041-6/+0
|
* Remove deprecated `ActiveRecord::Base.disable_implicit_join_references=`Rafael Mendonça França2015-01-041-7/+0
|
* Remove deprecated access to connection specification using a string acessor.Rafael Mendonça França2015-01-041-20/+1
| | | | Now all strings will be handled as a URL.
* Change the default `null` value for `timestamps` to `false`Rafael Mendonça França2015-01-043-18/+5
|
* Return an array of pools from `connection_pools`Rafael Mendonça França2015-01-041-10/+1
|
* Return a null column from `column_for_attribute` when no column exists.Rafael Mendonça França2015-01-043-12/+14
| | | | | | | | This reverts commit ae96f229f6501d8635811d6b22d75d43cdb880a4. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/attribute_methods.rb
* Remove deprecated `serialized_attributes`Rafael Mendonça França2015-01-041-13/+0
|
* Remove `cache_attributes` and friendsRafael Mendonça França2015-01-041-11/+0
|
* Remove deprecated automatic counter caches on `has_many :through`Rafael Mendonça França2015-01-041-14/+0
|
* Merge pull request #18319 from kamipo/sql_type_has_been_determinedRafael Mendonça França2015-01-041-4/+2
|\ | | | | `sql_type` has been determined already when quoting defaults
| * `sql_type` has been determined already when quoting defaultsRyuta Kamizono2015-01-041-4/+2
| | | | | | | | No need to call `type_to_sql` again.
* | Merge pull request #18318 from ↵Rafael Mendonça França2015-01-041-1/+2
|\ \ | | | | | | | | | | | | kamipo/stop_passing_the_column_when_quoting_defaults Stop passing the column to the `quote` method when quoting defaults
| * | Stop passing the column to the `quote` method when quoting defaultsRyuta Kamizono2015-01-041-1/+2
| |/ | | | | | | Related the commit 8f8f8058e58dda20259c1caa61ec92542573643d.
* / Prefer `array?` rather than `array`Ryuta Kamizono2015-01-043-8/+7
|/ | | | | | Slightly refactoring `PostgreSQLColumn`. `array` should be readonly. `default_function` should be initialized by `super`. `sql_type` has been removed `[]`. Since we already choose to remove it we should not change.
* Merge pull request #17227 from claudiob/explicitly-abort-callbacksRafael Mendonça França2015-01-036-22/+27
|\ | | | | | | | | | | | | Introduce explicit way of halting callback chains by throwing :abort. Deprecate current implicit behavior of halting callback chains by returning `false` in apps ported to Rails 5.0. Completely remove that behavior in brand new Rails 5.0 apps. Conflicts: railties/CHANGELOG.md
| * Deprecate `false` as the way to halt AR callbacksclaudiob2015-01-026-21/+20
| | | | | | | | | | | | | | | | | | | | Before this commit, returning `false` in an ActiveRecord `before_` callback such as `before_create` would halt the callback chain. After this commit, the behavior is deprecated: will still work until the next release of Rails but will also display a deprecation warning. The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
| * Deprecate `false` as the way to halt AS callbacksclaudiob2015-01-021-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | After this commit, returning `false` in a callback will display a deprecation warning to make developers aware of the fact that they need to explicitly `throw(:abort)` if their intention is to halt a callback chain. This commit also patches two internal uses of AS::Callbacks (inside ActiveRecord and ActionDispatch) which sometimes return `false` but whose returned value is not meaningful for the purpose of execution. In both cases, the returned value is set to `true`, which does not affect the execution of the callbacks but prevents unrequested deprecation warnings from showing up.
| * Throw :abort halts default CallbackChainsclaudiob2015-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes arguments and default value of CallbackChain's :terminator option. After this commit, Chains of callbacks defined **without** an explicit `:terminator` option will be halted as soon as a `before_` callback throws `:abort`. Chains of callbacks defined **with** a `:terminator` option will maintain their existing behavior of halting as soon as a `before_` callback matches the terminator's expectation. For instance, ActiveModel's callbacks will still halt the chain when a `before_` callback returns `false`.
* | Merge branch 'master' of github.com:rails/docrailsVijay Dev2015-01-031-3/+4
|\ \
| * | Fix doc formatting for `count_by_sql`claudiob2015-01-011-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ![before](https://cloud.githubusercontent.com/assets/10076/5592809/25ce08e8-9199-11e4-9dfe-5baa8bd6b658.png) After: ![after](https://cloud.githubusercontent.com/assets/10076/5592810/25ceef9c-9199-11e4-88f4-d286203d7f6f.png) [ci skip]
* | | Merge pull request #18307 from brainopia/datetime_regressionRafael Mendonça França2015-01-021-1/+5
|\ \ \ | |_|/ |/| | Fully support datetime values in AR::Type::DateTime#type_cast_for_database
| * | Support datetime values in AR::Type::DateTime#type_cast_for_databasebrainopia2015-01-031-1/+5
| | |
* | | Cleanup methods, missing spacing and missing nodocseileencodes2015-01-022-33/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add missing nodoc's Change `assoc_klass` argument name to `association_klass` Change `prev_reflection` argument name to `previous_reflection` Change `prev` to `previous_reflection` in `#get_chain` Switch use of `refl` and `reflection` in `#get_chain` so main parameter is not abbreviated. Add missing space in `#add_constraints`
* | | Move `#type_caster` to alias tracker initializeeileencodes2015-01-023-13/+10
| | | | | | | | | | | | | | | This moves the `#type_caster` from the `aliased_table_for` and into the initialize of the `alias_tracker`.
* | | Add `#all_includes` method to reflectionseileencodes2015-01-022-1/+5
| | | | | | | | | | | | | | | `yield` instead of relying on checking if the reflection is equal to the `chain_head`.
* | | Initialze `#alias_tracker` with base table nameeileencodes2015-01-023-11/+12
| | | | | | | | | | | | | | | | | | | | | Instead of initializing an empty connection use the base table name instead. Split up and refactor `#create` to be 2 methods `#create` and `#create_with_joins`. Removes the need to update the count by 1 on initialzing a JoinDependency.
* | | Move `alias_candiate` into `AbstractReflection`eileencodes2015-01-022-10/+16
| | | | | | | | | | | | | | | | | | This moves `alias_candidate` out of the `ReflectionProxy` and into the `AbstractReflection` so it is shared by all reflections. Change `alias_name` to a method and and remove assignment in `#get_chain`.
* | | Pass `connection` rather than `alias_tracker`eileencodes2015-01-022-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | After the refactorings we're only using the connection and not the alias tracker anymore. This builds on commit 18019. Reuse the already available `@connection` to reduce the surface area of the alias tracker's API. We can then remove the `attr_reader` because the connection is already available.
* | | Assign the `#alias_name` to each reflectioneileencodes2015-01-022-18/+15
| | | | | | | | | | | | This makes the `#alias_name` more functional.
* | | Clean up / refactor new reflection classeseileencodes2015-01-022-92/+76
| | | | | | | | | | | | | | | | | | Move `RuntimeReflection` and `PolymorphicReflect` into Reflection. This allows the methods to inherit from `ThroughReflection` and DRY up the methods by removing duplicates.
* | | Refactor `#get_chain` iteration to a linked listeileencodes2015-01-021-14/+21
| | | | | | | | | | | | | | | | | | The linked list lets us use a loop in `#add_constraints` and completely remove the need for indexing the iteration becasue we have access to the next item in the chain.
* | | Refactor `#get_chain` to remove need for `#construct_tables`eileencodes2015-01-021-14/+11
| | | | | | | | | | | | | | | | | | By concatnating the `ReflectionProxy` with the `chain` we remove the need for `#construct_tables` because the `chain` is now in the correct order (order of the chain DOES matter).
* | | Move `#alias_name` to `ReflectionProxy` classeileencodes2015-01-022-20/+23
| | | | | | | | | | | | | | | Putting the `#alias_name` into ReflectionProxy means we don't have to cache the `#alias_name` globally anymore - it's not cached per query.
* | | Clean up assignments in `#add_constraints`eileencodes2015-01-021-8/+3
| | | | | | | | | | | | | | | | | | `is_first_chain`, `items` and `klass` are no longer beneficial and can be called directly instead of via their assignments - because they are each only used once.
* | | Refactor construct_tables methodeileencodes2015-01-022-36/+20
| | | | | | | | | | | | | | | Move method structure into reflection classes for accessibly on each reflection rather than by traversing the chain.
* | | Add RuntimeReflection for recursive access to chaineileencodes2015-01-021-3/+54
| | | | | | | | | | | | | | | | | | | | | The `RuntimeReflection` class allows the reflection to be accessed at runtime - then we always know which reflection we are accessing in the chain. The `#get_chain` method then allows us to recursively access the chain through the `RuntimeReflection`.
* | | Add PolymorphicReflection and constraints methodeileencodes2015-01-022-4/+62
| | | | | | | | | | | | | | | | | | `#constraints` builds a flattened version of `scope_chain` to allow it to be accessible without requiring an index when iterating over the `scope_chain`
* | | A quick pass through NestedAttributes' doc [ci skip]Robin Dupret2015-01-021-18/+20
| | |
* | | Merge pull request #17822 from kamipo/refactor_visit_change_column_definitionRafael Mendonça França2015-01-024-16/+14
|\ \ \ | | | | | | | | Refactor `visit_ChangeColumnDefinition`
| * | | Refactor `visit_ChangeColumnDefinition`Ryuta Kamizono2015-01-032-11/+9
| | | | | | | | | | | | | | | | `visit_ChangeColumnDefinition` is the same "CHANGE column_name " + `visit_ColumnDefinition(o)`.
| * | | Add default value for `create_table_definition`Ryuta Kamizono2015-01-033-5/+5
| | | | | | | | | | | | | | | | | | | | In most cases, `create_table_definition` called by table_name (the first argument) only.
* | | | Merge pull request #8547 from printercu/patch-1Rafael Mendonça França2015-01-021-1/+6
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | fix for messages in invalid encoding from db-drivers Conflicts: activerecord/lib/active_record/connection_adapters/abstract_adapter.rb activerecord/test/cases/connection_adapters/abstract_adapter_test.rb
| * | | fix for messages in invalid encoding from db-driversMax Melentiev2013-12-071-1/+5
| | | |
* | | | Merge pull request #17820 from fw42/restore_query_cache_on_rollbackRafael Mendonça França2015-01-027-9/+17
|\ \ \ \ | | | | | | | | | | | | | | | Clear query cache on rollback
| * | | | Restore query cache on rollbackFlorian Weingarten2014-12-017-9/+17
| | | | |
* | | | | Merge pull request #15309 from iantropov/issue_12698_build_throughRafael Mendonça França2015-01-021-0/+11
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add setting of FK for throgh associations while building Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/associations/has_many_through_associations_test.rb