Method: Alchemy::Resource#initialize
- Defined in:
- app/models/alchemy/resource.rb
#initialize(controller_path, module_definition = nil, custom_model = nil) ⇒ Resource
Returns a new instance of Resource.
110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'app/models/alchemy/resource.rb', line 110 def initialize(controller_path, module_definition = nil, custom_model = nil) @controller_path = controller_path @module_definition = module_definition @model = custom_model || guess_model_from_controller_path if model.respond_to?(:alchemy_resource_relations) if !model.respond_to?(:reflect_on_all_associations) raise MissingActiveRecordAssociation end store_model_associations map_relations end end |