Method: ActivityNotification::Target#opened_notification_index_with_attributes

Defined in:
lib/activity_notification/models/concerns/target.rb

#opened_notification_index_with_attributes(options = {}) ⇒ Array<Notificaion>

Gets opened notification index of the target with including attributes like target, notifiable, group and notifier.

Examples:

Get opened notification index of the @user with included attributes

@notifications = @user.opened_notification_index_with_attributes(10)

Parameters:

  • options (Hash) (defaults to: {})

    Options for notification index

Options Hash (options):

  • :limit (Integer) — default: nil

    Limit to query for notifications

  • :reverse (Boolean) — default: false

    If notification index will be ordered as earliest first

  • :with_group_members (Boolean) — default: false

    If notification index will include group members

  • :as_latest_group_member (Boolean) — default: false

    If grouped notification will be shown as the latest group member (default is shown as the earliest member)

  • :filtered_by_type (String) — default: nil

    Notifiable type for filter

  • :filtered_by_group (Object) — default: nil

    Group instance for filter

  • :filtered_by_group_type (String) — default: nil

    Group type for filter, valid with :filtered_by_group_id

  • :filtered_by_group_id (String) — default: nil

    Group instance id for filter, valid with :filtered_by_group_type

  • :filtered_by_key (String) — default: nil

    Key of the notification for filter

  • :later_than (String) — default: nil

    ISO 8601 format time to filter notifications later than specified time

  • :earlier_than (String) — default: nil

    ISO 8601 format time to filter notifications earlier than specified time

  • :custom_filter (Array|Hash) — default: nil

    Custom notification filter (e.g. [“created_at >= ?”, time.hour.ago])

Returns:

  • (Array<Notificaion>)

    Opened notification index of the target with attributes



513
514
515
# File 'lib/activity_notification/models/concerns/target.rb', line 513

def opened_notification_index_with_attributes(options = {})
  include_attributes(_opened_notification_index(options)).to_a
end