aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* 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
| | |
* | | Dont simply assume a type is a valid database type. This is only always true ↵Vipul A M2016-04-252-1/+5
|/ / | | | | | | | | | | | | in the case of sqlite. Others adapters need to perform a check for validity. Add coverage for mysql2 db type validation
* | Add Expression Indexes and Operator Classes support for PostgreSQLRyuta Kamizono2016-04-244-18/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: create_table :users do |t| t.string :name t.index 'lower(name) varchar_pattern_ops' end Fixes #19090. Fixes #21765. Fixes #21819. Fixes #24359. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* | remove_index do not fetch indexes if name is specifiedSeva Orlov2016-04-241-1/+7
| | | | | | | | | | | | There is no need to fetch all table indexes in remove_index if name is specified. If name is wrong, then StatementInvalid will be raised. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* | Follow up of #23461Vipul A M2016-04-244-6/+8
| | | | | | | | | | | | | | | | - Rename max to statement_limit - Remove magic number 1000 from everywhere - Defined StatementPool::DEFAULT_STATEMENT_LIMIT and started using it everywhere Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* | Include the Savepoints module in all adapters.Vipul A M2016-04-247-17/+10
| | | | | | | | | | Adapters override `#supports_savepoints?` to return `true` if they support transaction savepoints. Defaults to `false`.
* | :nodoc: internal StatementPool class.Vipul A M2016-04-241-1/+1
| | | | | | | | [ci skip]
* | Merge pull request #23461 from kamipo/prepared_statements_for_mysql2_adapterJeremy Daer2016-04-233-55/+153
|\ \ | | | | | | | | | Add prepared statements support for `Mysql2Adapter`
| * | Add prepared statements support for `Mysql2Adapter`Ryuta Kamizono2016-04-213-56/+155
| | |
* | | Merge pull request #24708 from ↵Jeremy Daer2016-04-232-5/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | kamipo/move_select_rows_implementation_to_super_class Move `select_rows` implementation to super class
| * | | Move `select_rows` implementation to super classRyuta Kamizono2016-04-242-5/+1
| | | |
* | | | Merge pull request #24705 from kamipo/add_nodoc_to_insert_versions_sqlGuillermo Iguaran2016-04-232-2/+2
|\ \ \ \ | | | | | | | | | | Add `:nodoc:` to `insert_versions_sql` [ci skip]
| * | | | Add `:nodoc:` to `insert_versions_sql` [ci skip]Ryuta Kamizono2016-04-242-2/+2
| |/ / / | | | | | | | | | | | | Follow up to #24685. `insert_versions_sql` is not public API.
* | | | Merge pull request #24706 from kamipo/remove_in_doc_about_mysql_versions_below_5Guillermo Iguaran2016-04-231-3/+1
|\ \ \ \ | | | | | | | | | | Remove in the doc about MySQL versions below 5 [ci skip]
| * | | | Remove in the doc about MySQL versions below 5 [ci skip]Ryuta Kamizono2016-04-241-3/+1
| |/ / / | | | | | | | | | | | | | | | | Follow up to #23458. Active Record supports MySQL >= 5.0 now.
* / / / Move `require 'ipaddr'` in `postgresql/oid/cidr.rb`Ryuta Kamizono2016-04-242-2/+2
|/ / / | | | | | | | | | `IPAddr` is used in `OID::Cidr`.
* | | Followup of #15771Vipul A M2016-04-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure we handle explicitly passed nil's to lock_version as well. An explicitly passed nil value is now converted to 0 on LockingType, so that we don't end up with ActiveRecord::StaleObjectError in update record optimistic locking Fixes #24695
* | | Schema load: Fix dupe version insertJeremy Daer2016-04-221-1/+1
| | | | | | | | | | | | Re. 6e098284e97250eaed6f30f5c7c362d87da986b0
* | | Merge pull request #24685 from vipulnsward/sqlite-compat-for-multi-insertJeremy Daer2016-04-223-4/+25
|\ \ \ | | | | | | | | | | | | Gracefully fallback on version migrations for sqlite < 3.7.11
| * | | https://github.com/rails/rails/commit/42dd2336b31a8d98776d039a2b9fd7f834156a ↵Vipul A M2016-04-233-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 78 changed INSERT INTO versions to run in 1 single query. This breaks for sqlite versions < 3.7.11, which is especially the case on Ubuntu 12.04 LTS, that has SQLite version 3.7.9 as default. So we check for support for multi insert, before performing single query inserts, else fallback to older version of running multiple queries. [Vipul A M & Yasuo Honda]
* | | | Do not attempt to return connection with open transaction to pool (#24610)Sean Griffin2016-04-221-2/+3
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the query cache completes, if Active Record is still inside of a transaction, it is because the transaction is meant to be left open above this unit of work (such as transactional fixtures in tests). There were several tests around the behavior of "tests" that were invalid, as tests are not run through the executor. They have been changed to reflect the new behavior, which is closer to what actually occurs in Rails tests. Fixes #23989 Fixes #24491 Close #24500
* | | Merge pull request #24672 from mrkjlchvz/mc-space-bumpRafael França2016-04-211-1/+1
|\ \ \ | | | | | | | | Minor space bump.
| * | | Minor space bump.Mark2016-04-211-1/+1
| | | |
* | | | Revert "add doc for `:type` option of `#create_join_table` [ci skip]"प्रथमेश Sonpatki2016-04-211-2/+0
| | | |
* | | | add doc for `:type` option of `#create_join_table` [ci skip]yuuji.yaginuma2016-04-211-0/+2
| |/ / |/| | | | | | | | Follow up to #24221.
* | | Merge pull request #24221 from gregmolnar/uuidKasper Timm Hansen2016-04-201-2/+3
|\ \ \ | | | | | | | | create_join_table should work with uuid
| * | | add column type option to create_join_table to support uuidGreg Molnar2016-03-171-2/+3
| | | |
* | | | Merge pull request #23557 from ↵Jeremy Daer2016-04-201-20/+33
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | kamipo/dump_indexes_in_create_for_generates_sql_in_one_query Dump indexes in `create_table` for generates SQL in one query
| * | | | Dump indexes in `create_table` for generates SQL in one queryRyuta Kamizono2016-04-201-20/+33
| | | | | | | | | | | | | | | | | | | | | | | | | If the adapter supports indexes in create table, it generates SQL in one query.
* | | | | `undef_method` is not neededRyuta Kamizono2016-04-191-2/+3
|/ / / /
* | | | Fix `test_blank_columns_created_in_block`Ryuta Kamizono2016-04-201-1/+1
| | | | | | | | | | | | | | | | Follow up to 1683410.