mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
adding deprecated support for walking ancestor trees
This commit is contained in:
parent
e02a914fb0
commit
f62a7267c5
3 changed files with 17 additions and 0 deletions
|
@ -11,6 +11,11 @@
|
|||
* Nodes::Node#not factory method added for creating Nodes::Not nodes
|
||||
* Added an As node
|
||||
|
||||
* Deprecations
|
||||
|
||||
* Support for Subclasses of core classes will be removed in ARel version
|
||||
2.2.0
|
||||
|
||||
== 2.0.4
|
||||
|
||||
* Bug fixes
|
||||
|
|
|
@ -13,6 +13,13 @@ module Arel
|
|||
|
||||
def visit object
|
||||
send DISPATCH[object.class], object
|
||||
rescue NoMethodError
|
||||
warn "visiting #{object.class} via superclass, this will be removed in arel 2.2.0" if $VERBOSE
|
||||
superklass = object.class.ancestors.find { |klass|
|
||||
respond_to?(DISPATCH[klass], true)
|
||||
}
|
||||
DISPATCH[object.class] = DISPATCH[superklass]
|
||||
retry
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,6 +21,11 @@ module Arel
|
|||
end
|
||||
end
|
||||
|
||||
it "should visit string subclass" do
|
||||
@visitor.accept(Class.new(String).new(":'("))
|
||||
@visitor.accept(Class.new(Class.new(String)).new(":'("))
|
||||
end
|
||||
|
||||
it "should visit_Class" do
|
||||
@visitor.accept(DateTime).must_equal "'DateTime'"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue