Method: Strongbolt::Controllers::UrlHelpers.create_url_helper

Defined in:
lib/strongbolt/controllers/url_helpers.rb

.create_url_helper(url, scope = nil) ⇒ Object

Creates the url helpers for the specific url and scope



17
18
19
20
21
22
23
24
25
# File 'lib/strongbolt/controllers/url_helpers.rb', line 17

def self.create_url_helper(url, scope = nil)
  %i[path url].each do |path_or_url|
    class_eval <<-URL_HELPERS
      def #{scope.present? ? "#{scope}_" : ''}#{url}_#{path_or_url} *args
        send(:main_app).send("#{scope.present? ? "#{scope}_" : ''}strongbolt_#{url}_#{path_or_url}", *args)
      end
    URL_HELPERS
  end
end