Class: Graphgraph::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Graphgraph::Generators::InstallGenerator
- Defined in:
- lib/generators/graphgraph/install_generator.rb
Constant Summary collapse
- CONTROLLERS =
%w(graphgraphs).freeze
Instance Method Summary collapse
-
#copy_views ⇒ Object
source_root File.expand_path(“../templates/”, __FILE__).
- #create_controllers ⇒ Object
- #setup_routes ⇒ Object
Instance Method Details
#copy_views ⇒ Object
source_root File.expand_path(“../templates/”, __FILE__)
35 36 37 |
# File 'lib/generators/graphgraph/install_generator.rb', line 35 def copy_views directory "views/graphgraphs","app/views/#{scope || 'graphgraph'}/graphgraphs/" end |
#create_controllers ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/generators/graphgraph/install_generator.rb', line 13 def create_controllers @scope_prefix = scope.blank? ? '' : (scope.camelize + '::') controllers = [:controllers] || CONTROLLERS controllers.each do |name| template "controllers/#{name}_controller.rb", "app/controllers/#{scope}/#{name}_controller.rb" end end |
#setup_routes ⇒ Object
22 23 24 25 |
# File 'lib/generators/graphgraph/install_generator.rb', line 22 def setup_routes route("get '#{scope}s/graphgraph' => '#{scope}/graphgraphs#graphgraph'") route("post '#{scope}s/graphgraph' => '#{scope}/graphgraphs#graphgraph'") end |