module EventRecords # Read the database contract without requiring an application Event model. class EventRow < ActiveRecord::Base self.table_name = 'events' end def event_rows EventRow.order(:id).map(&:attributes) end def create_event! event_type:, created_by_user: nil EventRow.create!(event_type:, created_by_user_id: created_by_user&.id, created_at: Time.current) end end