Skip to content

Commit

Permalink
call find_by_url inside find_by_path so existing extensions continue …
Browse files Browse the repository at this point in the history
…to work. Closes #162
  • Loading branch information
saturnflyer committed Nov 7, 2010
1 parent 4187feb commit 1d446db
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/models/page.rb
Expand Up @@ -171,11 +171,11 @@ def find_by_path(path, live = true, clean = true)
elsif (path =~ /^#{Regexp.quote(my_path)}([^\/]*)/)
slug_child = children.find_by_slug($1)
if slug_child
found = slug_child.find_by_path(path, live, clean)
found = slug_child.find_by_url(path, live, clean) # TODO: set to find_by_path after deprecation
return found if found
end
children.each do |child|
found = child.find_by_path(path, live, clean)
found = child.find_by_url(path, live, clean) # TODO: set to find_by_path after deprecation
return found if found
end
file_not_found_types = ([FileNotFoundPage] + FileNotFoundPage.descendants)
Expand Down Expand Up @@ -212,7 +212,10 @@ def find_by_path(path, live = true)
raise MissingRootPageError unless root
root.find_by_path(path, live)
end
alias_method :find_by_url, :find_by_path
def find_by_url(*args)
ActiveSupport::Deprecation.warn("`find_by_url' has been deprecated; use `find_by_path' instead.", caller)
find_by_path(*args)
end

def date_column_names
self.columns.collect{|c| c.name if c.sql_type =~ /(date|time)/}.compact
Expand Down

0 comments on commit 1d446db

Please sign in to comment.