lib/searchjoy/search.rb in searchjoy-0.0.7 vs lib/searchjoy/search.rb in searchjoy-0.0.8
- old
+ new
@@ -1,18 +1,18 @@
module Searchjoy
class Search < ActiveRecord::Base
belongs_to :convertable, polymorphic: true
# the devise way
- if Rails::VERSION::MAJOR == 3 and !defined?(ActionController::StrongParameters)
+ 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)
- if !converted?
+ unless converted?
self.converted_at = Time.now
self.convertable = convertable
save(validate: false)
end
end
@@ -24,8 +24,7 @@
protected
def set_normalized_query
self.normalized_query = query.downcase if query
end
-
end
end