Class: PaypalPermissions::Generators::PaypalPermissionsGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/paypal_permissions/paypal_permissions_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_controllerObject



10
11
12
# File 'lib/generators/paypal_permissions/paypal_permissions_generator.rb', line 10

def generate_controller
  generate "controller", plural_name if behavior == :invoke
end

#insert_paypal_permissions_routesObject



16
17
18
19
20
21
22
23
24
# File 'lib/generators/paypal_permissions/paypal_permissions_generator.rb', line 16

def insert_paypal_permissions_routes
  if options.routes?
    # The request_permissions_callback route needs to be *first* in the routes.rb file,
    # but the generator inserts them at the top of the file, so call them in reverse order.

    route "resources :#{plural_name}"
    route "match '#{plural_name}/request_permissions_callback' => '#{plural_name}#request_permissions_callback', :via => [ :get ], :as => :#{plural_name}_request_permissions_callback"
  end
end