Sha256: 04d6484ef7dda8862c81bb46f3dd1caaa617b1e1e2b478aacefff16fdec3cb4d
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
class SearchEngine < ApplicationRecord acts_as_list validates :name, presence: true validates :query_param, presence: true validates :http_method, presence: true, inclusion: %w(get post) validates :url, presence: true, url: true, length: { maximum: 255 } validates :base_url, presence: true, url: true, length: { maximum: 255 } paginates_per 10 translates :display_name def search_params(query) params = {} if additional_param additional_param.gsub('{query}', query).to_s.split.each do |param| p = param.split('=') params[p[0].to_sym] = p[1] end return params end end end # == Schema Information # # Table name: search_engines # # id :bigint not null, primary key # name :string not null # display_name :text # url :string not null # base_url :text not null # http_method :text not null # query_param :text not null # additional_param :text # note :text # position :integer # created_at :datetime not null # updated_at :datetime not null # display_name_translations :jsonb not null #
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
enju_library-0.4.0.rc.1 | app/models/search_engine.rb |