app/helpers/admin/cms/url_helper.rb
# Loads routes and dumps them into an iVar
Loads routes and dumps them into an iVar
Loads routes and dumps them into an iVar
def load_routes
      routes = Rails.application.routes.routes.to_a
      routes.reject!{ |r| r.internal or !r.defaults.key?( :controller ) or r.name.nil? }
      self.routes = routes.map do |r|
        {
          controller: r.defaults[:controller],
          action:     r.defaults[:action].to_sym,
          name:       r.name,
          params:     r.parts.reject{ |p| p == :format }
        }
      end
    end
def load_routes routes = Rails . application . routes . routes . to_a routes . reject! { | r | r . internal or ! r . defaults . key? ( :controller ) or r . name . nil? } self . routes = routes . map do | r | { controller : r . defaults [ :controller ] , action : r . defaults [ :action ] . to_sym , name : r . name , params : r . parts . reject { | p | p == :format } } end end
Loads routes and dumps them into an iVar
Loads routes and dumps them into an iVar
# get our routes # filter out internal routes, those outside our base context, and those with no name # finally, map everything to a simpler version