class Guts::RoutesGenerator

Routes generator

Public Instance Methods

add_route() click to toggle source

Inserts the route into an existing routes file

# File lib/generators/guts/routes/routes_generator.rb, line 12
def add_route
  options[:pathname].insert(0, '/') unless options[:pathname][0] == '/'

  inject_into_file(
    'config/routes.rb',
    %(\n  mount Guts::Engine => "#{options[:pathname]}"\n),
    after: '.routes.draw do'
  )
end