Sha256: a7fd8c7d1440d1e456597a7ea3db7db4bbedd65769bb0eec657878f3ef763b94

Contents?: true

Size: 335 Bytes

Versions: 3

Compression:

Stored size: 335 Bytes

Contents

module ActiveRecord
  class Base

    def self.nql(query, options={})
      nql! query, options
    rescue NQL::Error
      self.where('1=2')
    end

    def self.nql!(query, options={})
      nql_search(query).result(options)
    end

    def self.nql_search(query)
      NQL::Query.new(self, query).ransack_search
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nql-0.1.2 lib/nql/extension/active_record.rb
nql-0.1.1 lib/nql/extension/active_record.rb
nql-0.1.0 lib/nql/extension/active_record.rb