Sha256: 4e0519194eeb4adfd0e489173e2c48f9d03ac04a44d693aeded7097c82c4c1b2

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 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
  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

7 entries across 7 versions & 2 rubygems

Version Path
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/ransack-1.6.2/lib/ransack/naming.rb
ransack-1.6.5 lib/ransack/naming.rb
ransack-1.6.4 lib/ransack/naming.rb
ransack-1.6.3 lib/ransack/naming.rb
ransack-1.6.2 lib/ransack/naming.rb
ransack-1.6.1 lib/ransack/naming.rb
ransack-1.6.0 lib/ransack/naming.rb