Class: FriendlyIdPlugin

Inherits:
SorbetRails::ModelPlugins::Base show all
Defined in:
lib/sorbet-rails/gem_plugins/friendly_id_plugin.rb

Overview

typed: strong

Constant Summary

Constants inherited from SorbetRails::ModelPlugins::Base

SorbetRails::ModelPlugins::Base::Parameter

Instance Attribute Summary

Attributes inherited from SorbetRails::ModelPlugins::Base

#available_classes, #model_class

Instance Method Summary collapse

Methods inherited from SorbetRails::ModelPlugins::Base

#initialize

Methods included from SorbetRails::ModelUtils

#add_relation_query_method, #exists_class_method?, #exists_instance_method?, #model_assoc_proxy_class_name, #model_assoc_relation_class_name, #model_class, #model_class_name, #model_module_name, #model_relation_class_name, #model_relation_type_alias, #model_relation_type_class_name

Constructor Details

This class inherits a constructor from SorbetRails::ModelPlugins::Base

Instance Method Details

#generate(root) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/sorbet-rails/gem_plugins/friendly_id_plugin.rb', line 4

def generate(root)
  return unless @model_class.singleton_class.included_modules.include?(::FriendlyId)

  # Friendly method definition
  # https://github.com/norman/friendly_id/blob/53f1ca01c5d9e71b62812028ff009fd138fd41b5/lib/friendly_id/base.rb#L216
  add_relation_query_method(
    root,
    'friendly'
  )
end