Class: Step7RailsStructureControllers

Inherits:
KDomain::DomainModel::Step show all
Defined in:
lib/k_domain/domain_model/transform_steps/step7_rails_structure_controllers.rb

Overview

Locate rails controller files

Instance Attribute Summary collapse

Attributes inherited from KDomain::DomainModel::Step

#domain_data, #opts, #valid

Instance Method Summary collapse

Methods inherited from KDomain::DomainModel::Step

#camel, #database, #database=, #database_foreign_keys, #database_tables, #domain, #domain_models, #find_foreign_table, #find_rails_structure_models, #find_table_for_model, #guard, #initialize, #investigate, #issues, #rails_resource, #rails_resource_controllers, #rails_resource_models, #rails_resource_models=, #rails_resource_routes, #rails_resource_routes=, #rails_structure, #rails_structure_controllers, #rails_structure_controllers=, #rails_structure_models, #rails_structure_models=, run, #table_name_exist?, #warning, #write

Constructor Details

This class inherits a constructor from KDomain::DomainModel::Step

Instance Attribute Details

#controllersObject

Returns the value of attribute controllers.



5
6
7
# File 'lib/k_domain/domain_model/transform_steps/step7_rails_structure_controllers.rb', line 5

def controllers
  @controllers
end

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/k_domain/domain_model/transform_steps/step7_rails_structure_controllers.rb', line 7

def call
  raise 'Rails controller path not supplied' unless opts[:controller_path]

  @controllers = {}

  rails_resource_routes.map do |route|
    process_route(OpenStruct.new(route))
  end

  self.rails_structure_controllers = controllers.keys.map { |key| controllers[key] }

  attach_behavior_and_functions
end