aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql."Jon Leighton2012-08-012-21/+0
| | | | | | | | | | 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-18/+1
| | | | | | | | | | | | | | | | 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.
* missing require: the AR session store depends on the AP abstract storeXavier Noria2012-07-281-0/+2
| | | | | | | | This require makes the dependency even more clear. In particular we are eager loading the session store but that does not work if AR is used outside Rails, this patch is preliminary work in fixing #7160.
* Only require the `:rails_env` task where is needed.Rafael Mendonça França2012-07-271-13/+13
| | | | | | | | | | `:rails_env` tasks is not needed in all the tasks that depends of `load_config`, only in the tasks that uses `Rails.env`. Since `:rails_env` task set the `Rails.env` to be "development" if it is not set we don't need the `||` statements too Fix #7175.
* Merge branch '3-2-rel' into 3-2-stableAaron Patterson2012-07-261-1/+1
|\ | | | | | | | | | | | | | | | | | | * 3-2-rel: updating release date bumping to 3.2.7 updating the changelog * Do not convert digest auth strings to symbols. CVE-2012-3424 updating the version updating changelogs
| * bumping to 3.2.7Aaron Patterson2012-07-261-1/+1
| |
| * updating the versionAaron Patterson2012-07-231-2/+2
| |
* | Suggest using update_columns instead of update_column.Philip Arndt2012-07-261-1/+1
| | | | | | | | | | | | update_column is deprecated in Rails 4.0 so it makes no sense to recommend adopting it only to require changing to update_columns in the very next release.
* | New #update_columns method.Sebastian Martinez2012-07-261-0/+17
|/
* Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-07-202-0/+21
|
* AR::Integration must be included after AM::ConversionJohn Firebaugh2012-07-171-1/+1
| | | | | | 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-4/+8
| | | | Fix GH #4259. When we execute schema dumper, we must remove table_name_prefix and table_name_suffix.
* Fixing texts; down to three failing tests.Jeremy Cole2012-07-132-15/+24
|
* Only use prepared statements when bind variables are presentJeremy Cole2012-07-131-34/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prepared statements (prepare/execute/close) were being used unnecessarily when no bind variables were present, and disabling prepared statement using prepared_statements:false was principally broken. While bind variables were correctly substituted with prepared_statements:false, the prepared statement interface was still used, costing an extra two round trips per query. In addition to making this behavioral change, I also cleaned up the internals of exec_stmt and exec_without_stmt so that they behave the same (calling log and constructing the ActiveRecord::Result in the same way). Moving the check for binds.empty? to exec_query also will mean that several code paths explicitly calling exec_without_stmt could be cleaned up to once again call exec_query instead. I have also left the check for binds.empty? in exec_stmt, since it is not a private method and could be called directly with an empty binds array. For the sake of clarity in this patch, I have not made those changes. = The previous behavior = When issuing a Foo.find(1) with prepared_statements:true, the bind variable is present in the prepared query, and execute shows a value passed: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Prepare SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = ? LIMIT 1 Execute SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Close stmt Quit When issuing a Foo.find(1) with prepared_statements:false, the bind variable has already been removed and substituted with the value, but the prepared statement interface is used anyway: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Prepare SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Execute SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Close stmt Quit = With this patch applied = When issuing a Foo.find(1) with prepared_statements:true, the bind variable is present in the prepared query, and execute shows a value passed: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Prepare SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = ? LIMIT 1 Execute SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Close stmt Quit When issuing a Foo.find(1) with prepared_statements:false, the bind variable has been removed and substituted with the value, and the query interface is used instead of the prepared statement interface: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Query SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Quit
* Update psql adapter to rename a default pkey sequence during rename_table.Robb Kidd2012-07-101-0/+7
|
* Merge pull request #6985 from sidonath/disable-query-cache-for-locksRafael Mendonça França2012-07-061-1/+9
| | | | | | 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-15/+21
| | | | | | | 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-281-0/+2
| | | | | | fix bug in limit of enum columns of mysql Closes #6432
* Merge pull request #6900 from cbandy/issue-6898Carlos Antonio da Silva2012-06-281-0/+2
| | | | | | Require URI in ConnectionSpecification Conflicts: activerecord/lib/active_record/connection_adapters/connection_specification.rb
* Ensure Arel columns are typecasted properly when grouping with calculationCarlos Antonio da Silva2012-06-251-3/+3
| | | | | | | | 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-6/+17
| | | | | | Stop assuming strings for grouped calculations Conflicts: activerecord/lib/active_record/relation/calculations.rb
* Merge branch 'acapilleri-update_nested_attributes'Rafael Mendonça França2012-06-211-5/+15
| | | | | | | Closes #6675 Conflicts: activerecord/lib/active_record/attribute_methods/dirty.rb
* Merge pull request #6758 from caironoleto/masterJosé Valim2012-06-181-13/+13
| | | | | | Fixing load config in some tasks Conflicts: activerecord/lib/active_record/railties/databases.rake
* Deprecating composed_of in ActiveRecordSteve Klabnik2012-06-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Deprecate update_attribute.Steve Klabnik2012-06-143-6/+10
| | | | | | | | | | | 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-122-4/+4
|\ | | | | | | | | | | | | | | | | | | * 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
| * bumping version numbersAaron Patterson2012-06-111-1/+1
| |
| * Additional fix for CVE-2012-2661Ernie Miller2012-06-111-3/+3
| | | | | | | | | | | | | | | | 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 #6676 from aurelian/masterRafael Mendonça França2012-06-121-1/+1
|/ | | | Don't assign the attributes if the list is empty
* Fix GH #3163. Should quote database on mysql/mysql2.kennyj2012-06-111-1/+1
| | | | | | 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-0/+2
| | | | | | Fix that #exists? can blow up with ThrowResult exception Conflicts: activerecord/lib/active_record/relation/finder_methods.rb
* Minimal change to query generation of exists? that makes SQLServer and ↵iaddict2012-06-101-1/+1
| | | | | | | others happy that do not work without a column alias. Conflicts: activerecord/lib/active_record/relation/finder_methods.rb
* Merge pull request #6695 from kennyj/fix_6635Rafael Mendonça França2012-06-101-5/+5
| | | | Fix #6635. We should call Scoping methods, before calling Array methods.
* ActiveRecord#attributes optimization: minimize objects createdTieg Zaharia2012-06-091-1/+3
|
* Revert "Perf: Don't load the association for #delete_all."Jon Leighton2012-06-074-33/+9
| | | | | | | | | | This reverts commit b98d1e21635d8776de8893cc09bd86c71f6c78f0. Closes #6609 Conflicts: activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
* Fix #6591. If a field with timezone isn't changed, we don't call will_change!.kennyj2012-06-041-1/+2
|
* bumping to 3.2.5Aaron Patterson2012-05-311-1/+1
|
* Restore behavior of Active Record 3.2.3 scopesAndrew White2012-06-012-5/+4
| | | | | | | | | | | | | | 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-rel' into 3-2-stableAaron Patterson2012-05-311-1/+1
|\ | | | | | | | | | | | | | | * 3-2-rel: bumping to 3.2.4 adding security notifications to CHANGELOGs updating changelogs Merge pull request #6558 from parndt/fix_regression
| * bumping to 3.2.4Aaron Patterson2012-05-311-1/+1
| |
| * Merge branch '3-2-stable-sec' into 3-2-relAaron Patterson2012-05-312-4/+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
| * | Merge pull request #6558 from parndt/fix_regressionAaron Patterson2012-05-301-3/+4
| | | | | | | | | | | | Fix regression
* | | Merge branch '3-2-stable-sec' into 3-2-stableAaron Patterson2012-05-313-6/+21
|\ \ \ | | |/ | |/| | | | | | | | | | | | | * 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-302-4/+19
| |/ | | | | | | | | | | Thanks to Ben Murphy for reporting this CVE-2012-2661
| * bumping to 3.2.4.rc1Aaron Patterson2012-05-281-2/+2
| |
* | Revert "Removes unneeded caching from ActiveRecord::Base.relation"Philip Arndt2012-05-311-3/+4
| | | | | | | | | | | | | | | | | | | | This reverts commit ebfa58abc895c0639211cb896a47b04e424322c8. This change caused a regression in my application's tests: * Failing build http://travis-ci.org/#!/resolve/refinerycms/builds/1461242 Broken tests pass after this change is reverted.
* | Merge pull request #6477 from steveklabnik/close_discovered_pg_connectionRafael Mendonça França2012-05-301-1/+2
| | | | | | | | Properly discover a connection is closed in postgresql_adapter
* | Merge pull request #5810 from kennyj/fix_5797Aaron Patterson2012-05-303-5/+6
|/ | | | | | Fix #5797. Error calling dup method on AR model with serialized field Conflicts: activerecord/lib/active_record/core.rb
* Merge pull request #5244 from fotos/myqsl2_wait_timeoutRafael Mendonça França2012-05-251-1/+1
| | | | Maximum wait_timeout on Windows is 2147483