Module: ExpoTurbo::Rails::DomIds

Defined in:
lib/expo_turbo/rails/dom_ids.rb

Constant Summary collapse

DEPRECATOR_NAME =
:expo_turbo_rails
DEPRECATOR =
ActiveSupport::Deprecation.new("0.5.0", "expo_turbo-rails")
RECORD_DEPRECATION_MESSAGE =
"ExpoTurbo::Rails::DomIds.id_for is deprecated and will be removed in expo_turbo-rails 0.5.0; " \
"replace id_for(record) or id_for(record, :record) with dom_id(record), not dom_id(record, :record), " \
"because the legacy :record role meant no prefix"

Class Method Summary collapse

Class Method Details

.id_for(record_or_class, role = :record) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/expo_turbo/rails/dom_ids.rb', line 18

def id_for(record_or_class, role = :record)
  DEPRECATOR.warn(deprecation_message(role))
  prefix = case role
  when :record then nil
  else role
  end
  ActionView::RecordIdentifier.dom_id(record_or_class, prefix)
end