Class: Arpa::ResourcesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/arpa/templates/controllers/resources_controller.rb

Instance Method Summary collapse

Instance Method Details

#generate_resources_and_actionsObject

GET /generate_resources_and_actions



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/arpa/templates/controllers/resources_controller.rb', line 14

def generate_resources_and_actions
  Rails.application.eager_load!

  resource_params = {
    resourceables: ApplicationController.descendants,
    except_action_methods: ApplicationController.action_methods
  }
  resource_creator.create(resource_params,
                          success: success_callback,
                          fail: fail_callback)

  redirect_to resources_path
end

#indexObject

GET /resources



6
7
8
# File 'lib/generators/arpa/templates/controllers/resources_controller.rb', line 6

def index
  @resources = resource_finder.all
end

#showObject

GET /resources/1



11
# File 'lib/generators/arpa/templates/controllers/resources_controller.rb', line 11

def show; end