lib/extensions/action_dispatch/routing/mapper.rb
# Draw the route using the directory and file name.
# @param directory_name [String]
Draw the route using the directory and file name.
Draw the route using the directory and file name .
def draw_routes(directory_name = "")
        page_files = Dir["#{Rails.root.join('app', 'views', 'pages', directory_name)}/*.html.erb"]
        page_files.each do |file_name|
          page = File.basename(file_name, ".html.erb")
          controller_name = directory_name.blank? ? "pages" : "pages/#{directory_name}"
          if page == "index"
            path = directory_name.dasherize
            path_name = directory_name
          else
            path_name = directory_name.blank? ? page : "#{directory_name}_#{page}"
            path = "#{directory_name}/#{page}".dasherize
          end
          get path, to: "#{controller_name}##{page}", as: path_name.blank? ? "root" : path_name
        end
      end
def draw_routes ( directory_name = "" ) page_files = Dir [ "#{Rails.root.join('app', 'views', 'pages', directory_name)}/*.html.erb" ] page_files . each do | file_name | page = File . basename ( file_name , ".html.erb" ) controller_name = directory_name . blank? ? "pages" : "pages/#{directory_name}" if page == "index" path = directory_name . dasherize path_name = directory_name else path_name = directory_name . blank? ? page : "#{directory_name}_#{page}" path = "#{directory_name}/#{page}" . dasherize end get path , to : "#{controller_name}##{page}" , as : path_name . blank? ? "root" : path_name end end
Draw the route using the directory and file name.
Draw the route using the directory and file name .
directory_name
None