mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
22 lines
513 B
Ruby
22 lines
513 B
Ruby
module UserEvents
|
|
extend ActiveSupport::Concern
|
|
|
|
module ClassMethods
|
|
def registrar_events(id)
|
|
registrar = Registrar.find(id)
|
|
return [] unless registrar
|
|
@events = []
|
|
registrar.users.each { |user| @events << user_events(user.id) }
|
|
registrar.epp_users.each { |user| @events << epp_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
|