mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
eedirekt domain histories
This commit is contained in:
parent
a426862aa8
commit
9e9cc07075
7 changed files with 111 additions and 1 deletions
24
app/models/concerns/user_events.rb
Normal file
24
app/models/concerns/user_events.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
module UserEvents
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
module ClassMethods
|
||||
def registrar_events(id)
|
||||
registrar = Registrar.find(id)
|
||||
return nil unless registrar
|
||||
@events = []
|
||||
registrar.users.each { |user| @events << user_events(user.id) }
|
||||
registrar.epp_users.each { |user| @events << user_events(user.id) }
|
||||
@events
|
||||
end
|
||||
|
||||
def user_events(id)
|
||||
where(whodunnit: id.to_s)
|
||||
end
|
||||
|
||||
def epp_user_events(id)
|
||||
where(whodunnit: "#{id}-EppUser")
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
|
@ -1,4 +1,6 @@
|
|||
class DomainVersion < PaperTrail::Version
|
||||
include UserEvents
|
||||
|
||||
scope :deleted, -> { where(event: 'destroy') }
|
||||
|
||||
self.table_name = :domain_versions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue