app/models/unidom/action/searching.rb in unidom-action-1.17.7 vs app/models/unidom/action/searching.rb in unidom-action-1.17.8
- old
+ new
@@ -5,10 +5,11 @@
class Unidom::Action::Searching < Unidom::Action::ApplicationRecord
self.table_name = 'unidom_searchings'
include Unidom::Common::Concerns::ModelExtension
+ include Unidom::Action::Concerns::AsCaused
validates :resource_name, presence: true, length: { in: 1..self.columns_hash['resource_name'].limit }
validates :platform_name, presence: true, length: { in: 1..self.columns_hash['platform_name'].limit }
validates :platform_version, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
@@ -18,14 +19,12 @@
validates :total_pages, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
validates :current_page, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
belongs_to :searcher_visitor, polymorphic: true
belongs_to :searcher_party, polymorphic: true
- belongs_to :reason, class_name: 'Unidom::Action::Reason'
scope :searched_by, ->(searcher_party) { where searcher_party: searcher_party }
scope :searched_via, ->(searcher_visitor) { where searcher_visitor: searcher_visitor }
- scope :caused_by, ->(reason) { where reason_id: to_id(reason) }
scope :resource_name_is, ->(resource_name) { where resource_name: resource_name }
scope :platform_name_is, ->(platform_name) { where platform_name: platform_name }
scope :platform_version_is, ->(platform_version) { where platform_version: platform_version }