aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
* Fix bug when Column is trying to type cast boolean values to integer.Rafael Mendonça França2012-10-293-6/+22
| | | | | | | | This can occur if the user is using :integer columns to store boolean values. Now we are handling the boolean values but it still raises if the value can't type cast to integer and is not a boolean. See #7509. Fixes #8067.
* Merge pull request #8009 from graceliu/3-2-fix_database_url_supportRafael Mendonça França2012-10-294-37/+57
|\ | | | | | | fixed support for DATABASE_URL for rake db tasks
| * fixed support for DATABASE_URL for rake db tasksGrace Liu2012-10-294-37/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport for #7521 - added tests to confirm establish_connection uses DATABASE_URL and Rails.env correctly even when no arguments are passed in. - updated rake db tasks to support DATABASE_URL, and added tests to confirm correct behavior for these rake tasks. (Removed establish_connection call from some tasks since in those cases the :environment task already made sure the function would be called) - updated Resolver so that when it resolves the database url, it removes hash values with empty strings from the config spec (e.g. to support connection to postgresql when no username is specified). - updated ResolverTest to use current_adapter? to check the type of the current adapter.
* | Bump to 3.2.9.rc1Santiago Pastorino2012-10-291-2/+2
|/
* Merge pull request #8057 from frodsan/fix_sqlite_mutate_argRafael Mendonça França2012-10-292-1/+9
| | | | | | SQLite3Adapter#type_cast should not mutate arguments Conflicts: activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
* Merge pull request #8053 from henrik/update_columns_with_primary_keyCarlos Antonio da Silva2012-10-293-1/+17
| | | | | | | | Unbreak update_column/update_columns for the primary key attribute. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/persistence.rb activerecord/test/cases/persistence_test.rb
* Make Active Record tests pass in isolationRafael Mendonça França2012-10-292-3/+2
| | | | Also remove the feature detecting for Ruby 1.9
* Fix the skip code.Rafael Mendonça França2012-10-281-4/+4
| | | | Checking for the constant doesn't work
* Merge pull request #7593 from veader/patch-1Rafael Mendonça França2012-10-283-0/+14
| | | | | | | Decode attributes pulled from URI.parse Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/connection_adapters/connection_specification.rb
* frozen state should be restored after txn is abortedAaron Patterson2012-10-222-2/+18
|
* Use `Rails.env` instead of `ENV['RAILS_ENV']`; #7951Martin Grandrath2012-10-181-1/+1
| | | | | | | `ENV['RAILS_ENV']` is not defined unless explicitly specified on the command line when running `rake db:structure:load`. This patch lets the rake task retrieve the environment from `Rails.env` which defaults to "development".
* Merge pull request #7371 from csmuc/fix_dup_validation_errorsSantiago Pastorino2012-10-173-0/+21
| | | | | | | Dup'ed ActiveRecord objects may not share the errors object Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/dup_test.rb
* Synchronize around deleting from the reserved connections hash.Aaron Patterson2012-10-152-1/+4
| | | | Fixes #7955
* 7914 Using a better way to get the defaults from db.Arturo Pie2012-10-141-12/+7
| | | | | | | | | | | | | | | | Changes: * According to postgreSQL documentation: (http://www.postgresql.org/docs/8.2/static/catalog-pg-attrdef.html) we should not be using 'adsrc' field because this field is unaware of outside changes that could affect the way that default values are represented. Thus, I changed the queries to use "pg_get_expr(adbin, adrelid)" instead of the historical "adsrc" field. * Remove parsing of character type default values for 8.1 formatting since Rails doesn't support postgreSQL 8.1 anymore. * Remove misleading comment unrelated to code.
* #7914 get default value when type uses schema nameArturo Pie2012-10-144-2/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | PostgreSQL adapter properly parses default values when using multiple schemas and domains. When using domains across schemas, PostgresSQL prefixes the type of the default value with the name of the schema where that type (or domain) is. For example, this query: ``` SELECT a.attname, d.adsrc FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = "defaults"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum; ``` could return something like "'<default_value>'::pg_catalog.text" or "(''<default_value>'::pg_catalog.text)::text" for the text columns with defaults. I modified the regexp used to parse this value so that it ignores anything between ':: and \b(?:character varying|bpchar|text), and it allows to have optional parens like in the above second example.
* Fix has_many assocation w/select load after createErnie Miller2012-10-123-1/+15
| | | | | | | | | | If you create a new record via a collection association proxy that has not loaded its target, and which selects additional attributes through the association, then when the proxy loads its target, it will inadvertently trigger a deprecation notice during attribute writing when CollectionAssociation#merge_target_lists attempts to do its thing, since the newly loaded records will possess attributes the created record does not.
* Eager autoload Preloader classesJohn Firebaugh2012-10-101-10/+14
| | | | | | Without eager autoloading, these would be autoloaded only when #preloader_for is called, which is too late in threaded applications.
* Eager autoload ActiveRecord association helpersMichael Fairley2012-10-101-5/+7
|
* Merge pull request #7850 from ↵Rafael Mendonça França2012-10-063-5/+14
| | | | | | | | | senny/5920_postgres_adapter_table_with_capital_letters postgres, quote table names when fetching the primary key (#5920) Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
* Merge pull request #6978 from frodsan/count_nosql_unsaved_parentRafael Mendonça França2012-10-045-0/+37
| | | | Count returns 0 without querying if parent is not saved
* RefactorSantiago Pastorino2012-10-031-5/+3
| | | | | Conflicts: activerecord/lib/active_record/counter_cache.rb
* Merge pull request #7822 from lulalala/reset-counter-cache-for-has-many-throughRafael Mendonça França2012-10-025-4/+29
| | | | | | | Fix reset_counters crashing on has_many :through associations. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/counter_cache.rb
* backport 68677ffb8298105eb9d3efa26d928dd88cc5e006Evan Petrie2012-09-284-6/+13
|
* ConnectionPool accepts spec key 'checkout_timeout'Jonathan Rochkind2012-09-244-5/+39
| | | | | | | Backport of #6441 cb6f83935 . Old 'wait_timeout' is still supported, but conflicts with mysql2 using that spec key for different thing. 'checkout_timeout' can now be used taking precedence for ConnectionPool over 'wait_timeout'.
* Merge pull request #3544 from amatsuda/_field_changedAaron Patterson2012-09-214-5/+23
| | | | | | | | Rename field_changed? to _field_changed? so that users can create a field named field Conflicts: activerecord/lib/active_record/core.rb activerecord/test/cases/dirty_test.rb
* Revert "backport fair connection pool 02b2335563 to 3-2-stable"Rafael Mendonça França2012-09-207-311/+51
| | | | | | | | | | | | | This reverts commit 0693e079708a52b777f2b7872b8e3d467b880a0d. Revert "Cache columns metadata to avoid extra while testing" This reverts commit a82f1e3f5d11c8dfba9f4c911745ec40a7965216. Reason: This is causing failures in the postgresql build. See http://travis-ci.org/#!/rails/rails/builds/2485584 Related with #7675
* Load the environment after creating the databaseJeremy Kemper2012-09-191-2/+2
| | | | | Conflicts: activerecord/lib/active_record/railties/databases.rake
* Cache columns metadata to avoid extra while testingRafael Mendonça França2012-09-183-1/+11
|
* backport fair connection pool 02b2335563 to 3-2-stableJonathan Rochkind2012-09-174-50/+300
|
* Merge pull request #7661 from ernie/build-join-records-on-unsaved-hmtRafael Mendonça França2012-09-173-0/+25
| | | | Fix collection= on hm:t join models when unsaved
* Merge pull request #7666 from ↵Rafael Mendonça França2012-09-171-1/+1
| | | | | | kennyj/fix_9fa3f102813eeeec440abd75870dfa7b23835665 Fix warning: method redefine. Testcase name are duplicated.
* Merge pull request #7651 from steveklabnik/issue_3956Rafael Mendonça França2012-09-162-2/+32
| | | | | | | | | Don't preserve SELECT columns on COUNT Closes #7651 Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb
* Backport explain fixes.Rafael Mendonça França2012-09-165-13/+27
| | | | | | | | * Mark as SCHEMA some schema database queries. #7648 * Don't explain queries except normal CRUD sql. #7657 Closes #6458 Closes #7544
* `skip` in Ruby 1.8 doesn't skip the test case without returnRafael Mendonça França2012-09-131-1/+1
|
* fix markdown markup in AR/CHANGELOGFrancesco Rodríguez2012-09-131-1/+1
|
* Backport PostgreSQL auto-reconnect test coverageSteve Jorgensen2012-09-134-0/+82
| | | | | | | | | | | | | | | | 6d5f4de4c420ebb906109668f5702a537ac77692 Simulated & actual (manual/skipped) PostgreSQL auto-reconnection tests. 4b1bca04025a66c54e6e9d5eb6e4d4056bfa92f0 Stop being silly with formatting of method aliasing. c381d5cbf959208adeb38e7859ee815dfbd2cf54 Fix just-plain-wrongness of psql auto-reconnect test. 1e17a9d367c54c680368be72f44247ae28b98904 Fix only-once stub logic. f16c2043826ec1991cf94fe17cb671507b7a7f51 Changelog for PostgreSQL auto-reconnect test coverage backport.
* Backported #7572 to 3-2-stable. Use config['encoding'], because database ↵kennyj2012-09-122-3/+9
| | | | configuration use not charset but encoding.
* Merge pull request #7582 from tchandy/fix_type_cast_codeRafael Mendonça França2012-09-094-2/+36
|\ | | | | type_cast_code should always convert values to integer calling #to_i
| * ConnectionAdapters::Column.type_cast_code should always convert values to ↵Thiago Pradi2012-09-094-2/+36
| | | | | | | | integer calling #to_i
* | Fix AR tests due to builder change with nil values / empty stringsCarlos Antonio da Silva2012-09-071-6/+6
| | | | | | | | | | Check 0180e090ab6cbe66f7b521a0c03e278a0463accd for more reasoning about that.
* | Merge pull request #7337 from adzap/string_to_dummy_timeRafael Mendonça França2012-09-053-1/+23
| | | | | | | | | | | | Fix for time type columns with invalid time value Conflicts: activerecord/CHANGELOG.md
* | set the configured #inheritance_column on #become (#7503)Yves Senn2012-09-036-2/+42
|/ | | | | | | | | | | | | | | | | | | I had to create a new table because I needed an STI table, which does not have both a "type" and a "custom_type" the test fails with: 1) Error: test_alt_becomes_works_with_sti(InheritanceTest): NoMethodError: undefined method `type=' for #<Cabbage id: 1, name: "my cucumber", custom_type: "Cucumber"> /Users/username/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:432:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/attribute_methods.rb:100:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/persistence.rb:165:in `becomes' test/cases/inheritance_test.rb:134:in `test_becomes_works_with_sti' test/cases/inheritance_test.rb:140:in `test_alt_becomes_works_with_sti' Conflicts: activerecord/test/cases/inheritance_test.rb
* documents after_(commit|rollback)Xavier Noria2012-08-301-0/+18
|
* Ensure association preloading properly merges default scope and association ↵Pratik Naik2012-08-284-3/+25
| | | | | | | | conditions Conflicts: activerecord/test/models/reader.rb
* CHANGELOGs are now per branchXavier Noria2012-08-281-6558/+1
| | | | Check 810a50d for the rationale.
* Use Ruby 1.8 hash syntaxCarlos Antonio da Silva2012-08-212-3/+3
| | | | Introduced in backport 648c5a1369ed64608c3ca43a5ebc917687d20010.
* Use a model without counter cache to test read-only attributesRafael Mendonça França2012-08-211-9/+10
|
* Merge pull request #5210 from Pliny/masteriRafael Mendonça França2012-08-218-2/+36
| | | | | | | | Fix for #5200 Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/counter_cache.rb
* Merge pull request #6986 from kennyj/fix_6975Rafael Mendonça França2012-08-213-5/+34
| | | | | | | Fix #6975. Round usec when writing timestamp attribute. Conflicts: activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
* Merge pull request #7377 from ↵Carlos Antonio da Silva2012-08-213-1/+11
| | | | | | | | | | | brainopia/use_inversed_parent_for_first_and_last_child Use inversed parent for first and last child of has_many association [Backport] Closes #3223. Conflicts: activerecord/lib/active_record/associations/collection_association.rb