Class: Excursion::Helpers::UrlHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/excursion/helpers/url_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/excursion/helpers/url_helper.rb', line 10

def method_missing(meth, *args)
  if meth.to_s.match(/\A(#{routes.collect { |name,route| name }.join("|")})_(url|path)\Z/)
    ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper.create(routes.get($1.to_sym), @application.default_url_options).call(Rails.application.routes, args)
  else
    super
  end
end

Instance Attribute Details

#applicationObject (readonly)

Returns the value of attribute application.



4
5
6
# File 'lib/excursion/helpers/url_helper.rb', line 4

def application
  @application
end

Instance Method Details

#routesObject



6
7
8
# File 'lib/excursion/helpers/url_helper.rb', line 6

def routes
  @application.routes
end