Sha256: 431d190835373e14ff23ef8dadd7ed125cfd1cca31d87aea40d81cb9c48d3fd5

Contents?: true

Size: 650 Bytes

Versions: 15

Compression:

Stored size: 650 Bytes

Contents

module Mobility
  module Backend
    class Sequel::Serialized::QueryMethods < Sequel::QueryMethods
      def initialize(attributes, **)
        super
        attributes_extractor = @attributes_extractor
        cond_checker = @cond_checker = lambda do |cond|
          if i18n_keys = attributes_extractor.call(cond)
            raise ArgumentError,
              "You cannot query on mobility attributes translated with the Serialized backend (#{i18n_keys.join(", ")})."
          end
        end

        define_method :where do |*cond, &block|
          cond_checker.call(cond.first) || super(*cond, &block)
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mobility-0.1.20 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.19 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.18 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.17 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.16 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.15 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.14 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.13 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.12 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.11 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.10 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.7 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.6 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.5 lib/mobility/backend/sequel/serialized/query_methods.rb
mobility-0.1.4 lib/mobility/backend/sequel/serialized/query_methods.rb