Skip to content

Question: Save with custom columns #317

Answered by excid3
janpeterka asked this question in Q&A
Discussion options

You must be logged in to vote

See https://github.com/excid3/noticed/blob/main/docs/delivery_methods/database.md and

recipient.send(association_name).create!(attributes)

class MyNotification do
  deliver_by :database, format: :custom_attributes

  def custom_attributes
    notification.params.slice(:announcement, :content, :content_message).merge(
      type: notification.class.name,
      params: notification.params
    )
  end
end

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@artur1313
Comment options

@excid3
Comment options

@artur1313
Comment options

@excid3
Comment options

@phil-6
Comment options

Answer selected by janpeterka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #316 on October 25, 2023 15:05.