Class: Guts::RoutesGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/guts/routes/routes_generator.rb

Overview

Routes generator

Instance Method Summary collapse

Instance Method Details

#add_routeObject

Inserts the route into an existing routes file



12
13
14
15
16
17
18
19
20
# 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