Sha256: 208918a156b51581910e20b0a1c9abddc7db12e6fff82ba63a0189e9eb637252
Contents?: true
Size: 837 Bytes
Versions: 3
Compression:
Stored size: 837 Bytes
Contents
module Searchjoy class Search < ActiveRecord::Base if Rails::VERSION::MAJOR == 5 belongs_to :convertable, polymorphic: true, optional: true else belongs_to :convertable, polymorphic: true end # 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
searchjoy-0.3.2 | app/models/searchjoy/search.rb |
searchjoy-0.3.1 | app/models/searchjoy/search.rb |
searchjoy-0.3.0 | app/models/searchjoy/search.rb |