Sha256: e93c72b2fb96ec6806cd9cb2e2e8b1f33cb703deed8160c3a2dc83f61e4496fd

Contents?: true

Size: 599 Bytes

Versions: 1

Compression:

Stored size: 599 Bytes

Contents

module Ixtlan
  module Controllers
    module SearchQuery

      private 

      def simple_query(search_parameter)
        query(search_parameter, params[search_parameter])
      end

      def query(parameter, value)
        args = {}
        args[:limit] = params[:limit].to_i + 1 if params[:limit]
        args[:offset] = params[:offset].to_i if params[:offset]

        if value
          if "false" == params[:fuzzy]
            args[parameter] = value
          else
            args[parameter.like] = "%" + value.to_s + "%"
          end
        end
        args
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ixtlan-0.4.0.pre4 lib/ixtlan/controllers/search_query.rb