Permalink
Browse files

Have current_controller? handle strings as the url

  • Loading branch information...
1 parent 2b6b898 commit 8f88093aa5987a7e30e68cb268b180182210763f @UnderpantsGnome committed Aug 7, 2007
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/rails_extensions.rb
View
@@ -60,11 +60,13 @@ def back_link(text='Back', *args)
end
def current_controller?(*options)
- options = options[1] if options.is_a?(Array)
- return false unless options.useful? || options.is_a?(Hash)
- opts = options.dup
- opts[:action] = :index
- url_for({:action => :index}) == url_for(opts)
+ begin
+ options = options[1] if options.is_a?(Array)
+ return false unless options.useful? || options.is_a?(Hash)
+ opts = options.dup
+ opts[:action] = :index
+ url_for({:action => :index}) == url_for(opts)
+ rescue Exception; end
end
end
end

0 comments on commit 8f88093

Please sign in to comment.