Sha256: f8e856c0238062d169116f94eb76f5ad46c4eda8d9b488cbb7348c41e31d2a85
Contents?: true
Size: 667 Bytes
Versions: 2
Compression:
Stored size: 667 Bytes
Contents
module Searchjoy class Search < ActiveRecord::Base belongs_to :convertable, polymorphic: true # the devise way if Rails::VERSION::MAJOR == 3 and !defined?(ActionController::StrongParameters) attr_accessible :search_type, :query, :results_count end before_save :set_normalized_query def convert(convertable = nil) if !converted? self.converted_at = Time.now self.convertable = convertable save(validate: false) end end def converted? converted_at.present? end protected def set_normalized_query self.normalized_query = query.downcase if query end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
searchjoy-0.0.7 | lib/searchjoy/search.rb |
searchjoy-0.0.6 | lib/searchjoy/search.rb |