# class ActivityObserver

### Public Instance Methods

after_create(record) click to toggle source

    # File app/observers/activity_observer.rb, line 4
    def after_create(record)
      Event.create(
        project: record.project,
        target_id: record.id,
        target_type: record.class.name,
        action: Event.determine_action(record),
        author_id: record.author_id
      )
    end

after_save(record) click to toggle source

    # File app/observers/activity_observer.rb, line 14
    def after_save(record)
      if record.changed.include?("closed")
        Event.create(
          project: record.project,
          target_id: record.id,
          target_type: record.class.name,
          action: (record.closed ? Event::Closed : Event::Reopened),
          author_id: record.author_id_of_changes
        )
      end
    end