aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/dynamic_matchers.rb
Commit message (Collapse)AuthorAgeFilesLines
* Prevent invalid code when using dynamic finders with Ruby's reserved words.Lauro Caetano2013-12-111-2/+7
| | | | | | | | | | | | | | | | | | | | | The dynamic finder was creating the method signature with the parameters name, which may have reserved words and this way creating invalid Ruby code. Closes: #13261 Example: # Before Dog.find_by_alias('dog name') # Was creating this method def self.find_by_alias(alias, options = {}) # After Dog.find_by_alias('dog name') # Will create this method def self.find_by_alias(_alias, options = {})
* Avoid compiling regexs in AR::Base.respond_to?John Hawthorn2013-08-211-1/+1
| | | | | Caches the patterns of ActiveRecord::DynamicMatchers in a class instance variable.
* removes redundant requireXavier Noria2013-02-251-2/+0
| | | | It turns out this file is required in active_record.rb.
* AR loads activerecord-deprecated_finders, no need to add it to the GemfileXavier Noria2013-02-251-0/+2
|
* Renaming active_record_deprecated_finders to activerecord-deprecated_findersJon Leighton2012-08-171-5/+5
| | | | For consistency with the other AR extension plugins we are creating.
* Revert "Removing composed_of from ActiveRecord."Rafael Mendonça França2012-07-271-1/+1
| | | | | | | | | | | This reverts commit 14fc8b34521f8354a17e50cd11fa3f809e423592. 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
* made dynamic finders alias_attribute awareMaximilian Schneider2012-06-221-0/+1
| | | | | previously dynamic finders only worked in combination with the actual column name and not its alias defined with #alias_attribute
* Removing composed_of from ActiveRecord.Steve Klabnik2012-06-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* extract deprecated dynamic methodsJon Leighton2012-05-041-140/+38
|
* actually don't need to expand the aggregates at allJon Leighton2012-05-041-11/+1
|
* #to_sym is unnecessaryJon Leighton2012-05-041-3/+3
|
* de-globalise methodJon Leighton2012-05-041-8/+1
|
* extract code from AR::BaseJon Leighton2012-05-041-32/+28
|
* clean up implementation of dynamic methods. use method compilation etc.Jon Leighton2012-05-041-29/+199
|
* Refactor and cleanup in some ActiveRecord modulesCarlos Antonio da Silva2012-03-031-19/+23
| | | | | | | | | | | * 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
* Move argument validation into matchPaul McMahon2012-01-281-1/+1
|
* Fix regression from Rails 3.1Paul McMahon2012-01-271-1/+1
| | | | | | Under Rails 3.1, you were allowed to pass a hash to a find_or_create method with multiple attribute names, but this was broken as the arguments were being improperly validated.
* Split out most of the AR::Base code into separate modules :cake:Jon Leighton2011-12-151-0/+79