lib/vidibus/helpers/extensions/controller.rb in vidibus-helpers-0.0.3 vs lib/vidibus/helpers/extensions/controller.rb in vidibus-helpers-0.0.4

- old
+ new

@@ -3,15 +3,22 @@ module Extensions module Controller extend ActiveSupport::Concern included do - helper_method :current_host + helper_method :current_host, :current_url end # Returns current hostname with protocol. def current_host @current_host ||= "#{request.protocol}#{request.host_with_port}" + end + + # Returns the current url. + # Provide :params => true to include request params. + def current_url(options = {}) + path = (options[:params] == true) ? request.fullpath : request.path + "#{current_host}#{path}" end end end end end