aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
Commit message (Collapse)AuthorAgeFilesLines
* add API to pg for enabling / disabling hstoreAaron Patterson2013-01-282-0/+25
|
* updates a dynamic method heredoc docXavier Noria2013-01-281-2/+2
|
* explains why the query cache checks arel.lockedXavier Noria2013-01-281-0/+2
|
* Prevent Relation#merge from collapsing wheres on the RHSJon Leighton2013-01-272-21/+27
| | | | | | | | | | | | | | | | | | | | | | | This caused a bug with the new associations implementation, because now association conditions are represented as Arel nodes internally right up to when the whole thing gets turned to SQL. In Rails 3.2, association conditions get turned to raw SQL early on, which prevents Relation#merge from interfering. The current implementation was buggy when a default_scope existed on the target model, since we would basically end up doing: default_scope.merge(association_scope) If default_scope contained a where(foo: 'a') and association_scope contained a where(foo: 'b').where(foo: 'c') then the merger would see that the same column is representated on both sides of the merge and collapse the wheres to all but the last: where(foo: 'c') Now, the RHS of the merge is left alone. Fixes #8990
* Fix typo: adaptors => adapters [ci skip]Carlos Antonio da Silva2013-01-271-1/+1
|
* Fix cases where delete_records on a has_many association caused errorsDerek Kraan2013-01-274-4/+24
| | | | | | | | | | | | | because of an ambiguous column name. This happened if the association model had a default scope that referenced a third table, and the third table also referenced the original table (with an identical foreign_key). Mysql requires that ambiguous columns are deambiguated by using the full table.column syntax. Postgresql and Sqlite use a different syntax for updates altogether (and don't tolerate table.name syntax), so the fix requires always including the full table.column and discarding it later for Sqlite and Postgresql.
* Use `silence` instead of `quietly` to silence the `CheckPending` middleware.Lucas Mazza2013-01-261-1/+1
| | | | | | | | `Kernel.quietly` silences `STDOUT` and `STDERR`, which is useless if the logger is writing to a file, while `AS::Logger#silence` swaps the logger level to `ERROR`. Related to #8820 and #8052.
* Simplify type casting code for timezone aware attributesAndrew White2013-01-261-10/+5
| | | | | | With the addition of String#in_time_zone and Date#in_time_zone we can simplify the type casting code by checking if the value has an `in_time_zone` method.
* Fix handling of dirty time zone aware attributesLilibeth De La Cruz2013-01-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when `time_zone_aware_attributes` were enabled, after changing a datetime or timestamp attribute and then changing it back to the original value, `changed_attributes` still tracked the attribute as changed. This caused `[attribute]_changed?` and `changed?` methods to return true incorrectly. Example: in_time_zone 'Paris' do order = Order.new original_time = Time.local(2012, 10, 10) order.shipped_at = original_time order.save order.changed? # => false # changing value order.shipped_at = Time.local(2013, 1, 1) order.changed? # => true # reverting to original value order.shipped_at = original_time order.changed? # => false, used to return true end
* Merge remote-tracking branch 'docrails/master'Xavier Noria2013-01-263-5/+5
|\ | | | | | | | | | | Conflicts: actionpack/lib/action_view/helpers/form_options_helper.rb guides/code/getting_started/app/controllers/comments_controller.rb
| * Fix typoTatsuro Baba2013-01-221-1/+1
| |
| * Remove useless number signTatsuro Baba2013-01-181-2/+2
| | | | | | | | I think that these signs are probably mistake.
| * fix example of setting DEFAULTS in fixturesJonathan Garvin2013-01-161-2/+2
| |
* | `#count` in conjunction with `#uniq` performs distinct count.Yves Senn2013-01-261-1/+2
| | | | | | | | closes #6865
* | reduce the number of queries on IN clauses, fix relation queries in `where`Aaron Patterson2013-01-242-1/+6
| |
* | stop converting strings to symbolsAaron Patterson2013-01-241-1/+1
| |
* | Default dead_connection_timeout to 5Akira Matsuda2013-01-241-1/+1
| | | | | | | | or the ConnectionPool silently fails to close connections inside the Thread
* | Fix PostgreSQL tests on TravisAndrew White2013-01-241-0/+5
| | | | | | | | Travis only has PostgreSQL 9.1.x but 9.2 is required for range datatypes.
* | Add postgresql range types supportbUg2013-01-237-71/+117
| |
* | Revert "Round usec when writing timestamp attribute."Andrew White2013-01-221-13/+5
| | | | | | | | | | | | | | | | | | | | This reverts commit e9d2ad395ec2ef929d74752f3d71c80674044fbe. Closes #8460 Conflicts: activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb activerecord/test/cases/dirty_test.rb
* | Whitespaces :scissors:Rafael Mendonça França2013-01-221-12/+12
| | | | | | | | [ci skip]
* | Just ignore all PRAGMA queriesAkira Matsuda2013-01-221-1/+1
| |
* | Ignore schema queries on SQLite 3 as wellAkira Matsuda2013-01-221-1/+2
| |
* | Ignore "SHOW search_path" when counting PostgreSQL queriesAkira Matsuda2013-01-221-1/+1
| |
* | Refactored transaction state into its own object. Each transaction creates a ↵wangjohn2013-01-211-5/+24
| | | | | | | | new transaction state object upon initialization.
* | Removed reflects_transaction_state.wangjohn2013-01-201-1/+0
| |
* | Created state for a transaction and added tests.wangjohn2013-01-202-11/+25
| |
* | fix anonymous class issueDavid2013-01-201-0/+1
| |
* | Improve relation docs about to_sql and where_values_hashCarlos Antonio da Silva2013-01-191-4/+4
| | | | | | | | | | | | | | | | * User class instead of Users. * #where_values_hash does not change the value to downcase as the example was showing. [ci skip]
* | Merge pull request #8994 from Springest/fix_default_scope_update_all_delete_allJon Leighton2013-01-181-2/+2
|\ \ | | | | | | Fix .update_all and .delete_all when using a condition on a joined table in a default_scope
| * | Fix .update_all and .delete_all when using a condition on a joined tableDerek Kraan2013-01-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | in a default_scope. `Model.joins(...).where(condition_on_joined_table).update_all` / `delete_all` worked, but the same operation implemented with a default_scope generated a SQL error because ActiveRecord ignored the join but implemented the where condition anyways.
* | | Revert "Merge pull request #8989 from robertomiranda/use-rails-4-find-by"Guillermo Iguaran2013-01-184-8/+8
| | | | | | | | | | | | | | | This reverts commit 637a7d9d357a0f3f725b0548282ca8c5e7d4af4a, reversing changes made to 5937bd02dee112646469848d7fe8a8bfcef5b4c1.
* | | Merge pull request #8989 from robertomiranda/use-rails-4-find-byGuillermo Iguaran2013-01-184-8/+8
|\ \ \ | | | | | | | | Replace deprecated find_by_* with find_by
| * | | User Rails 4 find_byrobertomiranda2013-01-184-8/+8
| | | |
* | | | Undeprecate the :extend optionJon Leighton2013-01-182-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Suggested by @dhh. It doesn't affect the generated SQL, so seems reasonable to continue to allow it as an association option.
* | | | CollectionProxy should be default scopedJon Leighton2013-01-181-0/+1
| | | | | | | | | | | | | | | | Fixes #8795
* | | | Merge pull request #8912 from senny/8879_association_empty_methodJon Leighton2013-01-181-1/+1
|\ \ \ \ | | | | | | | | | | `CollectionAssociation#empty?` respects newly builded records
| * | | | `CollectionAssociation#empty?` respects newly builded recordsYves Senn2013-01-131-1/+1
| | | | |
* | | | | iterates the RDoc of update_column(s)Xavier Noria2013-01-181-13/+13
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | This revision makes crystal clear that the methods go straight to the database and update the receiver. It also adds and example, and removes the duplication in the singular and plural forms by referring one to the other.
* | | | Refactor predicate builder when receiving empty hashCarlos Antonio da Silva2013-01-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no need to create a new arel table or reflect on the column association if the value is empty, these attributes are not used. Also no need to concat a new array, just append the query value.
* | | | Don't rely on Hash key's orderingVitor Baptista2013-01-162-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we set encoding latin1 for a PostgreSQL database, it calls PostgreSQLAdapter::create_database with options that have, among other things: { 'encoding' => 'latin1' } Then, we use reverse_merge(:encoding => "utf8") to setup the default encoding. In the end, the hash looks like: { :encoding => 'utf8', 'encoding' => 'latin1' } The call to options.symbolize_keys calls to_sym on each_key of this Hash. It usually means that the encoding passed overwrites the default utf8, but it's not guaranteed. So, we shouldn't rely on it. The same was happening in ActiveRecord::ConnectionHandling.
* | | | Revert "Merge pull request #8930 from cordawyn/ordered_railties"Carlos Antonio da Silva2013-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8348f9ea72c9b50fc4d4462fd9ebe3bba932c783, reversing changes made to 9dfe2d6f9fabddf9a451a995678a9648c8aaf401. Reason: this broke railties tests as explained in the issue, and the author is going to review and report back. https://github.com/rails/rails/pull/8930#issuecomment-12272671
* | | | Merge pull request #8930 from cordawyn/ordered_railtiesCarlos Antonio da Silva2013-01-151-1/+1
|\ \ \ \ | | | | | | | | | | rake railties:install:migrations respects the order of railties
| * | | | rake railties:install:migrations respects the order of railtiesSlava Kravchenko2013-01-141-1/+1
| |/ / /
* / / / Improve mysql database tasks handling to ensure we always rescue from an ↵Carlos Antonio da Silva2013-01-151-9/+13
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | exception We were previously rescuing "nil" when no exception class was found. This does work in 1.9.3, but does not in 2.0, raising an exception asking for a class or module to be given to the rescue clause. Thanks @yahonda for catching this.
* | | Fix AR tests due to Mysql constant not being definedCarlos Antonio da Silva2013-01-123-7/+5
| | |
* | | Bring back "database already exists" messages when running rake tasksCarlos Antonio da Silva2013-01-124-13/+20
|/ / | | | | | | | | | | | | | | | | | | When running tasks such "rake db:setup", instead of showing messages like "db_development already exists", it was showing a big stack trace and a message "Couldn't create database for ..." with the configuration options, a very confusing message with a big trace. This brings back the functionality present in 3-2, showing the same message.
* | Merge pull request #8568 from inossidabile/fix-in_clause_lengthJon Leighton2013-01-111-1/+1
|\ \ | | | | | | Correct source for in_clause_length for eager loading (Fix for #8474)
| * | Eager loading made to use relation's in_clause_length instead of host's one ↵Boris Staal2012-12-201-1/+1
| | | | | | | | | | | | (fixes #8474)
* | | Merge pull request #8823 from acapilleri/target_reflection_has_associated_recordCarlos Antonio da Silva2013-01-081-5/+1
|\ \ \ | | | | | | | | Refactor target_reflection_has_associated_record?