Module: ReeDao::AssociationMethods::InstanceMethods
- Defined in:
- lib/ree_lib/packages/ree_dao/package/ree_dao/association_methods.rb
Constant Summary collapse
- SUFFIXES =
["", "s", "es", "dao", "s_dao", "es_dao"].freeze
Instance Method Summary collapse
Instance Method Details
#find_dao(assoc_name, parent_caller, scope = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ree_lib/packages/ree_dao/package/ree_dao/association_methods.rb', line 14 def find_dao(assoc_name, parent_caller, scope = nil) SUFFIXES.each do |suffix| dao_from_name = parent_caller.instance_variable_get("@#{assoc_name}#{suffix}") return dao_from_name if dao_from_name end if scope.is_a?(Sequel::Dataset) return scope.unfiltered end raise ArgumentError, "can't find DAO for :#{assoc_name}, provide correct scope or association name" end |