Method: ActiveModel::Naming.route_key

Defined in:
lib/active_model/naming.rb

.route_key(record_or_class) ⇒ Object

Returns string to use while generating route names. It differs for namespaced models regarding whether it’s inside isolated engine.

For isolated engine: ActiveModel::Naming.route_key(Blog::Post) #=> posts

For shared engine: ActiveModel::Naming.route_key(Blog::Post) #=> blog_posts



116
117
118
# File 'lib/active_model/naming.rb', line 116

def self.route_key(record_or_class)
  model_name_from_record_or_class(record_or_class).route_key
end