class Graphgraph::Generators::InstallGenerator

Constants

CONTROLLERS

Public Instance Methods

copy_views() click to toggle source

argument :scope, :required => false, :default => nil, :desc => “The scope to copy views to” source_root File.expand_path(“../templates/”, __FILE__)

# File lib/generators/graphgraph/install_generator.rb, line 35
def copy_views
  directory "views/graphgraphs","app/views/#{scope || 'graphgraph'}/graphgraphs/"
end
create_controllers() click to toggle source
# File lib/generators/graphgraph/install_generator.rb, line 13
def create_controllers
    @scope_prefix = scope.blank? ? '' : (scope.camelize + '::')
    controllers = options[:controllers] || CONTROLLERS
    controllers.each do |name|
      template "controllers/#{name}_controller.rb",
               "app/controllers/#{scope}/#{name}_controller.rb"
    end
end
setup_routes() click to toggle source
# 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