aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
* Do not consider the numeric attribute as changed if the old value isRafael Mendonça França2012-08-021-1/+14
| | | | | | | | | | | | | | | | | | | | zero and the new value is not a string. Before this commit this was the behavior r = Review.find_by_issue(0) r.issue => 0 r.changes => {} r.issue = 0 => 0 r.changed? => true r.changes => {"issue"=>[0,0]} Fixes #7237
* Backport #5168 to 3-2-stable. Fix a problem that NULLS is ignored by ↵kennyj2012-08-021-0/+5
| | | | postgresql_adapter.rb while creating distincts.
* Revert "Deprecating composed_of in ActiveRecord"Rafael Mendonça França2012-08-013-15/+7
| | | | This reverts commit 44b313bc4e3762da64dde7894548f81c595147de.
* Revert "Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql."Jon Leighton2012-08-015-76/+35
| | | | | | | | | | This reverts commit a79bfa92e7bdc31b346d13ee5447d3fdac382bfb. Conflicts: activerecord/CHANGELOG.md We shouldn't introducing deprecations in point releases. It will be deprecated in 4.0 instead.
* Revert "Add update_columns and the suggestion of using update_columnsRafael Mendonça França2012-07-301-57/+0
| | | | | | | | | | | | | | | | instead of update_column" This reverts commit 9fa06c3d9811113259cb6e00a3a8454b3974add7. This reverts commit 17a64de4980683da3ca3c185205013a29a8cf88d. This reverts commit def9c85ffbdcf63e6c412b6bd4abafaa32ccdb5c, reversing changes made to 6b7d26cf3c061907aedc44f7f36776c9b36950fd. Reason: This was supposed to be released with 3.2.7 before the suggestion to use update_column. Since it was not release now is not good to suggest to use another method because it will confusing the people.
* Fix AR#update_columns tests on Ruby 1.8.7Carlos Antonio da Silva2012-07-251-7/+7
|
* New #update_columns method.Sebastian Martinez2012-07-261-0/+57
|
* Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-07-205-35/+76
|
* Merge pull request #6616 from dpassage/fix_resolver_test_sqlite3Carlos Antonio da Silva2012-07-191-0/+3
| | | | Resolver tests fail if mysql adapter not installed
* AR::Integration must be included after AM::ConversionJohn Firebaugh2012-07-171-0/+6
| | | | | | Integration's definition of #to_param must override Conversion's. Otherwise, there is a regression from 3.1 in the behavior of a non-persisted AR::Base instance which nevertheless has an id.
* Merge pull request #4396 from kennyj/fix_4259Rafael Mendonça França2012-07-171-0/+32
| | | | Fix GH #4259. When we execute schema dumper, we must remove table_name_prefix and table_name_suffix.
* fixing tests to deal with data differences between prepared statements and ↵Aaron Patterson2012-07-133-3/+8
| | | | non-prepared statements
* Update psql adapter to rename a default pkey sequence during rename_table.Robb Kidd2012-07-101-0/+20
|
* Merge pull request #6985 from sidonath/disable-query-cache-for-locksRafael Mendonça França2012-07-061-0/+8
| | | | | | Disable query cache for lock queries Conflicts: activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
* Backport #3329 to 3-2-stableFrancesco Rodriguez2012-07-021-0/+10
| | | | | | | Fix bug with autosave collection association on new record with a marked for destroy record in autosave collection. Fixes #6918.
* Merge pull request #6878 from masarakki/masterRafael Mendonça França2012-06-284-0/+39
| | | | | | fix bug in limit of enum columns of mysql Closes #6432
* Ensure Arel columns are typecasted properly when grouping with calculationCarlos Antonio da Silva2012-06-251-2/+6
| | | | | | | | Fix build issue with postgresql. Conflicts: activerecord/lib/active_record/relation/calculations.rb activerecord/test/cases/calculations_test.rb
* Merge pull request #6842 from ernie/handle-non-strings-in-grouped-calculationsRafael Mendonça França2012-06-241-0/+5
| | | | | | Stop assuming strings for grouped calculations Conflicts: activerecord/lib/active_record/relation/calculations.rb
* Remove waning of unused variableRafael Mendonça França2012-06-211-1/+0
|
* Merge branch 'acapilleri-update_nested_attributes'Rafael Mendonça França2012-06-211-0/+10
| | | | | | | Closes #6675 Conflicts: activerecord/lib/active_record/attribute_methods/dirty.rb
* Deprecating composed_of in ActiveRecordSteve Klabnik2012-06-183-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature adds a lot of complication to ActiveRecord for dubious value. Let's talk about what it does currently: class Customer < ActiveRecord::Base composed_of :balance, :class_name => "Money", :mapping => %w(balance amount) end Instead, you can do something like this: def balance @balance ||= Money.new(value, currency) end def balance=(balance) self[:value] = balance.value self[:currency] = balance.currency @balance = balance end Since that's fairly easy code to write, and doesn't need anything extra from the framework, if you use composed_of today, you'll have to add accessors/mutators like that. This feature will be removed in Rails 4.
* Remove unneded tests.Rafael Mendonça França2012-06-141-11/+1
| | | | | | | Before b081f6b59fb3f15d12043072ad9b331ffd2bc56e, this test are asserting that update_attribute does the dirty tracking. Since we deprecated this method and update_column write in the database directly this tests will always fail.
* Deprecate update_attribute.Steve Klabnik2012-06-144-11/+31
| | | | | | | | | | | Historically, update_attribute and update_attributes are similar, but with one big difference: update_attribute does not run validations. These two methods are really easy to confuse given their similar names. Therefore, update_attribute is being deprecated in favor of update_column, and will be removed in Rails 4. See the discussion on rails-core here: https://groups.google.com/d/topic/rubyonrails-core/BWPUTK7WvYA/discussion
* Merge branch '3-2-stable-rel' into 3-2-stableAaron Patterson2012-06-121-0/+6
|\ | | | | | | | | | | | | | | | | | | * 3-2-stable-rel: updating changelogs bumping version numbers updating changelogs with security fixes updating changelogs Array parameters should not contain nil values. Additional fix for CVE-2012-2661
| * Additional fix for CVE-2012-2661Ernie Miller2012-06-111-0/+6
| | | | | | | | | | | | | | | | While the patched PredicateBuilder in 3.1.5 prevents a user from specifying a table name using the `table.column` format, it doesn't protect against the nesting of hashes changing the table context in the next call to build_from_hash. This fix covers this case as well.
* | Merge pull request #6715 from arunagw/add_assertsRafael Mendonça França2012-06-121-2/+2
| | | | | | | | Need a assert here in tests
* | Merge pull request #6676 from aurelian/masterRafael Mendonça França2012-06-121-0/+4
|/ | | | Don't assign the attributes if the list is empty
* Change the string to use in test case.kennyj2012-06-112-2/+2
| | | | | | | Conflicts: activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb activerecord/test/cases/adapters/mysql2/schema_test.rb
* Fix GH #3163. Should quote database on mysql/mysql2.kennyj2012-06-112-0/+21
| | | | | | Conflicts: activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
* Merge pull request #6698 from yahonda/address_ora_911_masterRafael Mendonça França2012-06-111-1/+1
| | | | Address ORA-00911 errors because of the heading underscore.
* Merge pull request #6521 from Empact/throw-resultRafael Mendonça França2012-06-101-1/+6
| | | | | | Fix that #exists? can blow up with ThrowResult exception Conflicts: activerecord/lib/active_record/relation/finder_methods.rb
* Remove warningRafael Mendonça França2012-06-101-1/+1
|
* Add test to column alias in `exists?` SQL.Rafael Mendonça França2012-06-101-0/+6
| | | | | | | | This behavior was added in dd286a4c735dac1db8c9262581c7f29c44d1f695 Closes #1139. Fixes #2553, #1141, #1623 and #2062.
* Merge pull request #6695 from kennyj/fix_6635Rafael Mendonça França2012-06-101-0/+9
| | | | Fix #6635. We should call Scoping methods, before calling Array methods.
* Make test cover previous reversionJon Leighton2012-06-071-0/+1
|
* Revert "Perf: Don't load the association for #delete_all."Jon Leighton2012-06-071-12/+0
| | | | | | | | | | This reverts commit b98d1e21635d8776de8893cc09bd86c71f6c78f0. Closes #6609 Conflicts: activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
* Add failing test for 3.2.5 datetime attribute regressionEvan Arnold2012-06-041-0/+11
|
* Skip test_remove_column_with_array_as_an_argument_is_deprecated with Oracle ↵Yasuo Honda2012-06-021-1/+3
| | | | | | | adapter. Because Oracle adapter supports only remove_column :table_name, :column_name syntax and it has never supported remove_column :table_name, [:column_name].
* Restore behavior of Active Record 3.2.3 scopesAndrew White2012-06-012-26/+0
| | | | | | | | | | | | | | A series of commits relating to preloading and scopes caused a regression. Cloning the relation calls initialize_copy which resets a number of instance variables to nil. Without this the scope thinks that it is already loaded when it is called again. Reverts the following commits: 13f1401a6cf0266a3b0a91b173f976db2d4e50f3 8491740ca5361ba9df20e1c8b906c709f5bfbc12 dffbb521a0d00c8673a3ad6e0e8ff526f32daf4e Fixes #6575, #6576 & #6577
* Merge branch '3-2-stable-sec' into 3-2-stableAaron Patterson2012-05-311-0/+19
|\ | | | | | | | | | | | | * 3-2-stable-sec: Strip [nil] from parameters hash. Thanks to Ben Murphy for reporting this! predicate builder should not recurse for determining where columns. Thanks to Ben Murphy for reporting this bumping to 3.2.4.rc1
| * predicate builder should not recurse for determining where columns.Aaron Patterson2012-05-301-0/+19
| | | | | | | | | | | | Thanks to Ben Murphy for reporting this CVE-2012-2661
* | Merge pull request #5810 from kennyj/fix_5797Aaron Patterson2012-05-301-0/+9
|/ | | | | | Fix #5797. Error calling dup method on AR model with serialized field Conflicts: activerecord/lib/active_record/core.rb
* Fixes the build break caused by 9ee8528 in #6445.Godfrey Chan2012-05-221-2/+4
| | | | | | | | Ruby 1.8 raises a TypeError when trying to modify a frozen Hash, while Ruby 1.9 raises a RuntimeError instead. Also, Ruby < 1.9.3 uses a lowercase 'hash' in the exception message while Ruby >= 1.9.3 uses an uppercase 'Hash' instead. This commit normalizes those issues in the test case.
* Restore the frozen state on rollback. Fixes #6417.Godfrey Chan2012-05-221-0/+10
| | | | | | | | | | | | | | | | | | | | | | This is a 3-2-stable backport for #6420 which was merged into master. Currently, when saving a frozen record, an exception would be thrown which causes a rollback. However, there is a bug in active record that "defrost" the record as a side effect: >> t = Topic.new => #<Topic id: nil, ...> >> t.freeze => #<Topic id: nil, ...> >> t.save RuntimeError: can't modify a frozen Hash >> t.frozen? => false >> t.save => true This patch fixes the bug by explictly restoring the frozen state on the attributes Hash after every rollback.
* Postgresql doesn't accept limits on binary (bytea) columns.Victor Costan2012-05-211-0/+1
|
* Fix `validates_uniqueness_off :field, :allow_nil => false`Piotr Sarnacki2012-05-191-0/+11
| | | | | | | | | | | | | | | | | | Closes (#5853) Uniqueness validator was not properly checking if there are any existing records, when value was `nil` and column was text type. `nil` was converted to string, which resulted in queries looking like: ```sql SELECT 1 FROM "posts" WHERE "posts"."title" = '' LIMIT 1 ``` instead of ```sql SELECT 1 FROM "posts" WHERE "posts"."title" IS NULL LIMIT 1 ```
* Ensure that CollectionAssociation#replace returns proper targetPiotr Sarnacki2012-05-191-2/+2
| | | | | | | | The fix commited in e2a070c was returning the `new_target`, as a try to return whatever user replaced association with. The problem is, the resulting association target may be ordered differently. In such case we want to return the target that will be later used for that association.
* fix #delete_all with habtm with :delete_sqlJon Leighton2012-05-181-0/+6
|
* Perf: Don't load the association for #delete_all.Jon Leighton2012-05-181-0/+12
| | | | | | | | Bug #6289 Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb
* Fix CollectionAssociation#replace to return new target (closes #6231)Piotr Sarnacki2012-05-161-0/+12
| | | | | | Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb