aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #24971 from arthurnn/arthurnn/dont_cache_specification_nameArthur Nogueira Neves2016-05-111-1/+1
|\ | | | | Dont cache the conn_spec_name when empty
| * Dont cache the conn_spec_name when emptyArthur Neves2016-05-111-1/+1
| | | | | | | | | | | | | | | | We cannot cache the connection_specification_name when it doesnt exist. Thats because the parent value could change, and we should keep failling back to the parent. If we cache that in a children as an ivar, we would not fallback anymore in the next call, so the children would not get the new parent spec_name.
* | Set conn_spec_name after removeArthur Neves2016-05-111-2/+2
|/ | | | | | `remove_connection` can reset the `connection_specification_name`, so we need to to set it after the remove_connection call on `establish_connection` method.
* [ci skip] Update documents of `ConnectionHandler`yui-knk2016-05-111-3/+1
| | | | | | | | Follow up of #24844. The key of `@owner_to_pool` was changed from `klass.name` to `spec.name`. By this change "memory leaks in development mode" will not happen, bacause the equality of string is not changed by reloading of model files.
* Make sure we reset the connection_specification_name onArthur Neves2016-05-101-1/+8
| | | | | | | | | | | | | | remove_connection When calling `remove_connection` on a model, we delete the pool so we also need to reset the `connection_specification_name` so it will fallback to the parent. This was the current behavior before rails 5, which will fallback to the parent connection pool. [fixes #24959] Special thanks to @jrafanie for working with me on this fix.
* Merge pull request #24950 from kamipo/should_quote_lock_nameRafael França2016-05-101-2/+2
|\ | | | | Should quote `lock_name` to pass to `get_advisory_lock`
| * Should quote `lock_name` to pass to `get_advisory_lock`Ryuta Kamizono2016-05-101-2/+2
| |
* | Merge pull request #24939 from Neodelf/again_with_loopXavier Noria2016-05-101-2/+1
|\ \ | |/ |/| Replacement cycle for readability
| * Replacement cycle for readabilityMolchanov Andrey2016-05-101-2/+1
| |
* | Add migration compatibility class for Rails 5.1Rafael Mendonça França2016-05-101-1/+4
| |
* | Start Rails 5.1 development :tada:Rafael Mendonça França2016-05-101-2/+2
|/
* Replacement cycle for readabilityMolchanov Andrey2016-05-091-2/+2
|
* Followup to #24844Jon Moss2016-05-072-3/+4
| | | | | | | Some slight documentation edits and fixes. Also, run remove unnecessary `RuntimeError`. r? @arthurnn
* Preparing for 5.0.0.rc1 releaseRafael Mendonça França2016-05-061-1/+1
|
* Merge pull request #24844 from arthurnn/arthurnn/connArthur Nogueira Neves2016-05-065-62/+66
|\ | | | | Refactor connection handler
| * Update docs for connection handlerArthur Neves2016-05-061-2/+5
| | | | | | | | [skip ci]
| * s/specification_name/connection_specification_nameArthur Neves2016-05-063-12/+12
| |
| * s/specification_id/specification_nameArthur Neves2016-05-055-35/+35
| |
| * Retrive the right pool for db tasksArthur Neves2016-05-051-2/+2
| |
| * inline retrive_conn_pool methodArthur Neves2016-05-051-12/+8
| |
| * Better code readabilityArthur Neves2016-05-052-4/+2
| |
| * Use spec key, when given as spec_idArthur Neves2016-05-051-1/+8
| |
| * Better specification_id methodArthur Neves2016-05-051-10/+7
| |
| * Rename methodArthur Neves2016-05-051-3/+3
| |
| * Refactor connection handlerArthur Neves2016-05-054-50/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ConnectionHandler will not have any knowlodge of AR models now, it will only know about the specs. Like that we can decouple the two, and allow the same model to use more than one connection. Historically, folks used to create abstract AR classes on the fly in order to have multiple connections for the same model, and override the connection methods. With this, now we can override the `specificiation_id` method in the model, to return a key, that will be used to find the connection_pool from the handler.
* | Allow the connection adapters to determine the order of bind paramsSean Griffin2016-05-062-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | In 5.0 we use bind parameters for limit and offset, while in 4.2 we used the values directly. The code as it was written assumed that limit and offset worked as `LIMIT ? OFFSET ?`. Both Oracle and SQL Server have a different syntax, where the offset is stated before the limit. We delegate this behavior to the connection adapter so that these adapters are able to determine how the bind parameters are flattened based on what order their specification has the various clauses appear. Fixes #24775
* | Merge pull request #24869 from vipulnsward/change-exampleRafael França2016-05-051-3/+3
|\ \ | | | | | | Change to use a more realistic example [ci skip]
| * | Change to use a more realistic example and not giving the impression that ↵Vipul A M2016-05-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | destroy_all is preferred way to destroy related records. This example just wants to demonstrate callback behaviour. [ci skip]
* | | Merge pull request #24868 from vipulnsward/delegate_encode_withRafael França2016-05-051-1/+1
|\ \ \ | |/ / |/| | delegate encode_with instead of to_yaml, which is deprecated
| * | delegate encode_with instead of to_yaml, which is deprecatedVipul A M2016-05-051-1/+1
| | |
* | | [ci skip] Don't promote SQL interpolation.Kasper Timm Hansen2016-05-051-2/+2
| | | | | | | | | | | | | | | | | | After fb898e9, the `before_destroy` had some code that used SQL interpolation left over. Don't think we should promote that even if the values aren't directly from user input.
* | | Merge pull request #24859 from y-yagi/do_not_pass_conditon_to_destroy_allVipul A M2016-05-052-3/+3
|\ \ \ | |_|/ |/| | do not pass conditions to `#destroy_all` [ci skip]
| * | do not pass conditions to `#destroy_all` [ci skip]yuuji.yaginuma2016-05-052-3/+3
| |/ | | | | | | Passing conditions to `#destroy_all` was deprecated in c82c5f8.
* / Fix some typos in comments.Joe Rafaniello2016-05-041-1/+1
|/ | | | [ci skip]
* Fix small typo in Active Record Migrations documentation [ci skip]Erol Fornoles2016-05-031-1/+1
|
* Do not delegate `AR::Base#empty?` to `all`Sean Griffin2016-05-021-1/+1
| | | | | | | | | | Unlike `one?` and `none?`, `empty?` has interactions with methods outside of enumerable. It also doesn't fit in the same vein. `Topic.any?` makes sense. `Topic.empty?` does not, as `Topic` is not a container. Fixes #24808 Close #24812
* Add `:nodoc:` to `schema_creation` [ci skip]Ryuta Kamizono2016-05-021-1/+1
| | | | | | | `schema_creation` is not public API. https://github.com/rails/rails/blob/v5.0.0.beta4/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L121 https://github.com/rails/rails/blob/v5.0.0.beta4/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L78
* Merge pull request #24713 from tomkadwill/fix_counter_cache_incrementSean Griffin2016-04-302-0/+3
|\ | | | | | | | | Fix counter_cache double increment bug Close #24183
| * Fix counter_cache double increment bugTom Kadwill2016-04-282-0/+3
| |
* | Replace `Rails.version.to_f` with Active RecordJon Moss2016-04-301-1/+1
| | | | | | | | | | Rails should not be explicity mentioned within Active Record, since railties and the Rails ecosystem is not required for use.
* | Extract `add_sql_comment!` methodRyuta Kamizono2016-04-292-17/+10
| | | | | | | | | | | | Refactor of #22911. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* | Treat blank comments as no comment for indexesRyuta Kamizono2016-04-292-5/+1
| | | | | | | | | | | | Follow up of 1683410. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* | Migrations: move version-finding responsibilityyui-knk2016-04-292-7/+11
| | | | | | | | | | | | | | `ActiveRecord::Migration` needn't know about migration version compatibility lookup. Delegate it to the Compatibility module. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* | Merge branch 'master' of github.com:rails/docrailsVijay Dev2016-04-292-2/+7
|\ \ | | | | | | | | | | | | Conflicts: guides/source/configuring.md
| * | s/statment/statement/Vipul A M2016-04-241-1/+1
| | |
| * | - Be consistent in providing file locations of schema, model and initializerVipul A M2016-04-131-1/+6
| | | | | | | | | | | | [ci skip]
* | | schema_load triggers 2nd schema_load (via locking)Keenan Brock2016-04-281-1/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | Currently, loading the schema (schema_load) accesses the locking column (locking_column) which defaults the value (reset_locking_column) which invalidates the schema (reload_schema_from_cache) which forces another schema load. Good news: The second schema_load does accesses locking_column, but locking_column is set, so it does not reset_locking_column and it does not trigger an infinite loop. The solution is not invalidate the cache while default locking_column
* | Prep Rails 5 beta 4eileencodes2016-04-271-1/+1
| |
* | Merge pull request #24730 from vipulnsward/move-savepointsRafael França2016-04-252-4/+4
|\ \ | | | | | | Move remaining current_savepoint_name to savepoints module
| * | Move remaining current_savepoint_name to savepoints moduleVipul A M2016-04-252-4/+4
| | |