Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove AM < 6.1 legacy conditional check #61

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/hawk/linker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _monomorphic_resource_accessor(entity, options)
def #{entity}
return nil unless self.#{key}.present?
@_#{entity} ||= #{respond_to?(:module_parent) ? module_parent : parent}::#{klass}.find(self.#{key})
@_#{entity} ||= #{module_parent}::#{klass}.find(self.#{key})
end
RUBY

Expand Down
8 changes: 2 additions & 6 deletions lib/hawk/model/lookup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def look_up_model_class(name, scope)
return self_constant
end

scope_parent = scope.respond_to?(:module_parent) ? scope.module_parent : scope.parent
scope_parent = scope.module_parent

if (parent_constant = look_up_constant_in(name, scope_parent))
return parent_constant
Expand All @@ -82,11 +82,7 @@ def look_up_model_class(name, scope)
end

def look_up_constant_in(name, scope)
if scope.respond_to?(:module_parent)
scope.module_parent.const_get(name)
else
scope.parent.const_get(name)
end
scope.module_parent.const_get(name)
rescue NameError
nil
end
Expand Down
Loading