Class: Pageflow::Generators::RoutesGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_routeObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/generators/pageflow/routes/routes_generator.rb', line 8

def add_route
  inject_into_file 'config/routes.rb', after: "  ActiveAdmin.routes(self)\n" do
    <<-HEREDOC
  authenticate :user, lambda { |user| user.admin? } do
    mount Resque::Server.new, at: "/background_jobs"
  end

  # Needs to be last in file
  Pageflow.routes(self)
    HEREDOC
  end
end

#require_resque_serverObject



21
22
23
# File 'lib/generators/pageflow/routes/routes_generator.rb', line 21

def require_resque_server
  prepend_to_file 'config/routes.rb', "require 'resque/server'\nrequire 'resque/scheduler/server'\n\n"
end