Sha256: 006d38aea5f527a228a4ee50ec3896228f2e2eb9aa11c07a308f698c604aba32

Contents?: true

Size: 652 Bytes

Versions: 2

Compression:

Stored size: 652 Bytes

Contents

module Vidibus
  module Helpers
    module Extensions
      module Controller
        extend ActiveSupport::Concern

        included do
          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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vidibus-helpers-0.0.5 lib/vidibus/helpers/extensions/controller.rb
vidibus-helpers-0.0.4 lib/vidibus/helpers/extensions/controller.rb