Module: SnFoil::Rails::InjectInclude

Extended by:
ActiveSupport::Concern
Defined in:
lib/snfoil/rails/concerns/inject_include.rb

Instance Method Summary collapse

Instance Method Details

#inject_include(**options) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/snfoil/rails/concerns/inject_include.rb', line 24

def inject_include(**options)
  return options if options[:include]
  return options unless options.dig(:params, :include)

  options[:include] = options.dig(:params, :include)
                             .split(',')
                             .map { |item| item.underscore.to_sym }
  options
end