Sha256: 532d2986624e53379e8a1bb35175c05d252820ee3421b8e440916d32d1c4bd4e
Contents?: true
Size: 630 Bytes
Versions: 25
Compression:
Stored size: 630 Bytes
Contents
# frozen_string_literal: true module Hyrax # A model name that provides routes that are namespaced to Hyrax, # without changing the param key. # # Example: # name = Hyrax::Name.new(MyWork) # name.param_key # # => 'my_work' # name.route_key # # => 'hyrax_my_works' # class Name < ActiveModel::Name def initialize(klass, namespace = nil, name = nil) super @route_key = "hyrax_#{ActiveSupport::Inflector.pluralize(@param_key)}" @singular_route_key = ActiveSupport::Inflector.singularize(@route_key) @route_key += "_index" if @plural == @singular end end end
Version data entries
25 entries across 25 versions & 1 rubygems