Sha256: 16ee20aed6afaedcb2013318a522d431a4b68b9516188013348f2b6a4f724773
Contents?: true
Size: 719 Bytes
Versions: 6
Compression:
Stored size: 719 Bytes
Contents
module Searchjoy class Search < ActiveRecord::Base belongs_to :convertable, polymorphic: true # the devise way if (Rails::VERSION::MAJOR == 3 && !defined?(ActionController::StrongParameters)) || defined?(ActiveModel::MassAssignmentSecurity) attr_accessible :search_type, :query, :results_count end before_save :set_normalized_query def convert(convertable = nil) unless 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
6 entries across 6 versions & 1 rubygems