app/models/mdm/session.rb in metasploit_data_models-0.24.5 vs app/models/mdm/session.rb in metasploit_data_models-1.0.0.pre.rails.pre.4.0a
- old
+ new
@@ -1,21 +1,22 @@
# A session opened on a {#host} using an {#via_exploit exploit} and controlled through a {#via_payload payload} to
# connect back to the local host using meterpreter or a cmd shell.
class Mdm::Session < ActiveRecord::Base
+
#
# Associations
#
# @!attribute [rw] events
# Events that occurred when this session was open.
#
# @return [Array<Mdm::Event>]
has_many :events,
- class_name: 'Mdm::SessionEvent',
- dependent: :delete_all,
- inverse_of: :session,
- order: 'created_at'
+ -> { order('created_at') },
+ class_name: 'Mdm::SessionEvent',
+ dependent: :delete_all,
+ inverse_of: :session
# @!attribute exploit_attempt
# Exploit attempt that created this session.
#
# @return [Mdm::ExploitAttempt]
@@ -160,12 +161,12 @@
#
# Scopes
#
- scope :alive, where('closed_at IS NULL')
- scope :dead, where('closed_at IS NOT NULL')
- scope :upgradeable, where("closed_at IS NULL AND stype = 'shell' and platform ILIKE '%win%'")
+ scope :alive, -> { where('closed_at IS NULL') }
+ scope :dead, -> { where('closed_at IS NOT NULL') }
+ scope :upgradeable, -> { where("closed_at IS NULL AND stype = 'shell' and platform ILIKE '%win%'") }
#
# Serializations
#