Sha256: fda1358d083bed9cf44862c1b98f1c2896447553b4b852788a4a3ecb8f0816b6

Contents?: true

Size: 1.08 KB

Versions: 41

Compression:

Stored size: 1.08 KB

Contents

module Ransack
  module Naming

    def self.included(base)
      base.extend ClassMethods
    end

    def persisted?
      false
    end

    def to_key
      nil
    end

    def to_param
      nil
    end

    def to_model
      self
    end

    def model_name
      self.class.model_name
    end
  end

  class Name < String
    attr_reader :singular, :plural, :element, :collection, :partial_path,
                :human, :param_key, :route_key, :i18n_key
    alias_method :cache_key, :collection

    def initialize
      super(Constants::CAP_SEARCH)
      @singular     = Constants::SEARCH
      @plural       = Constants::SEARCHES
      @element      = Constants::SEARCH
      @human        = Constants::CAP_SEARCH
      @collection   = Constants::RANSACK_SLASH_SEARCHES
      @partial_path = Constants::RANSACK_SLASH_SEARCHES_SLASH_SEARCH
      @param_key    = Constants::Q
      @route_key    = Constants::SEARCHES
      @i18n_key     = :ransack
    end
  end

  module ClassMethods
    def model_name
      @_model_name ||= Name.new
    end

    def i18n_scope
      :ransack
    end
  end

end

Version data entries

41 entries across 40 versions & 4 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/ransack-4.2.1/lib/ransack/naming.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/ransack-4.2.1/lib/ransack/naming.rb
ransack-4.2.1 lib/ransack/naming.rb
ransack-4.2.0 lib/ransack/naming.rb
ransack-4.1.1 lib/ransack/naming.rb
ransack-4.1.0 lib/ransack/naming.rb
ransack-4.0.0 lib/ransack/naming.rb
ransack-3.2.1 lib/ransack/naming.rb
ransack-3.2.0 lib/ransack/naming.rb
ransack-3.1.0 lib/ransack/naming.rb
ransack-3.0.1 lib/ransack/naming.rb
ransack-3.0.0 lib/ransack/naming.rb
ransack-2.6.0 lib/ransack/naming.rb
ransack-2.5.0 lib/ransack/naming.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/ransack-2.4.2/lib/ransack/naming.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/ransack-2.4.2/lib/ransack/naming.rb
ransack-2.4.2 lib/ransack/naming.rb
ransack-2.4.1 lib/ransack/naming.rb
ransack-2.4.0 lib/ransack/naming.rb
ransack-2.3.2 lib/ransack/naming.rb