I hate string evals

This commit is contained in:
Marc Remolt 2011-05-02 20:09:03 +02:00 committed by Philip Arndt
parent fe39fc757a
commit f917935994

View file

@ -28,17 +28,17 @@ module Refinery
# refinery 0.9.8 had a bug that we later found through using this engine. # refinery 0.9.8 had a bug that we later found through using this engine.
# the bug was that the plugin urls were not :controller => '/admin/whatever' # the bug was that the plugin urls were not :controller => '/admin/whatever'
if Refinery.version == '0.9.8' if Refinery.version == '0.9.8'
::Refinery::Plugin.class_eval %{ ::Refinery::Plugin.class_eval do
alias_method :old_url, :url alias_method :old_url, :url
def url def url
if (plugin_url = self.old_url).is_a?(Hash) and plugin_url[:controller] =~ %r{^admin} if (plugin_url = self.old_url).is_a?(Hash) and plugin_url[:controller] =~ %r{^admin}
plugin_url[:controller] = "/\#{plugin_url[:controller]}" plugin_url[:controller] = "/#{plugin_url[:controller]}"
end end
plugin_url plugin_url
end end
} end
end end
end end
end if defined?(Rails::Engine) end if defined?(Rails::Engine)