Class: StimulusGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/rails/stimulus/stimulus_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_controllerObject



11
12
13
# File 'lib/generators/rails/stimulus/stimulus_generator.rb', line 11

def create_controller
  template("controller.js", File.join("app/javascript/controllers/#{file_name}_controller.js"))
end

#create_controller_directoryObject



7
8
9
# File 'lib/generators/rails/stimulus/stimulus_generator.rb', line 7

def create_controller_directory
  empty_directory("app/javascript/controllers") unless File.directory?("app/javascript/controllers")
end