1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

15 commits

Author SHA1 Message Date
Ben Woosley
31a43ebc10 Don't allow quote_value to be called without a column
Some adapters require column information to do their job properly.
By enforcing the provision of the column for this internal method
we ensure that those using adapters that require column information
will always get the proper behavior.
2013-07-22 04:49:18 -07:00
Aaron Patterson
8b9f16fcb3 resolve aliases before passing the hash to the predicate builder 2013-07-02 11:22:22 -07:00
Zach Ohlgren
a6bc35c82c Fix bug in ActiveRecord::Sanitization#sanitize_sql_hash_for_conditions
Fixing CHANGLOG description

Remove extra line.

Remove blank lines.
2013-05-06 17:03:18 -07:00
Derek Kraan
0a71c7b864 Fix cases where delete_records on a has_many association caused errors
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.
2013-01-27 15:36:29 +00:00
AvnerCohen
890da5149d 1.9 Syntax related changes 2012-11-10 17:16:21 +02:00
Yves Senn
13206cc73c remove unused expand_range_bind_variables method
this method was not used, not documented and not tested.
2012-10-08 20:50:25 +02:00
Jon Leighton
e55c75d2d8 Pass in the model class rather than engine
In some circumstances engine was Arel::Table.engine which for separate
reasons was an ActiveRecord::Model::DeprecationProxy, which caused a
deprecation warning.

In any case, we want the actual model class here, since we want to use
it to infer information about associations.
2012-09-13 00:14:36 +01:00
Carlos Antonio da Silva
ec39055456 Minor refactor in ActiveRecord#initialize_dup
* There is no need to delete the primary key from cloned attributes,
  since it sets the same pk to nil afterwards.
* Check for empty? instead of any? to run initialize callbacks.
2012-09-07 14:31:49 -03:00
Xavier Noria
64bc8447c2 load active_support/concern in active_support/rails 2012-08-02 21:59:23 +02:00
Rafael Mendonça França
f4d818d51e Revert "Removing composed_of from ActiveRecord."
This reverts commit 14fc8b3452.

Reason: we need to discuss a better path from this removal.

Conflicts:
	activerecord/lib/active_record/reflection.rb
	activerecord/test/cases/base_test.rb
	activerecord/test/models/developer.rb
2012-07-27 19:25:14 -03:00
kennyj
539b69e05d Remove instance level quote_value method. This method is private and also exists in class method. 2012-07-14 03:06:18 +09:00
Steve Klabnik
14fc8b3452 Removing composed_of from ActiveRecord.
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.

Closes #1436
Closes #2084
Closes #3807
2012-06-18 14:53:03 -04:00
Jon Leighton
4bd9482a1a de-globalise method 2012-05-04 12:50:07 +01:00
Carlos Antonio da Silva
50725cec39 Refactor and cleanup in some ActiveRecord modules
* Avoid double hash lookups in AR::Reflection when reflecting associations/aggregations
* Minor cleanups: use elsif, do..end, if..else instead of unless..else
* Simplify DynamicMatchers#respond_to?
* Use "where" instead of scoped with conditions hash
* Extract `scoped_by` method pattern regexp to constant
* Extract noisy class_eval from method_missing in dynamic matchers
* Extract readonly check, avoid calling column#to_s twice in persistence
* Refactor predicate builder, remove some variables
2012-03-03 04:09:50 -03:00
Jon Leighton
ceb33f8493 Split out most of the AR::Base code into separate modules 🍰 2011-12-15 20:45:37 +00:00