Skip to content

How to access notification_methods in Notifier concern? #479

Closed Answered by ogirginc
ogirginc asked this question in Q&A
Discussion options

You must be logged in to vote

Yep, it was me missing something very obvious here 😅

This won't work as the passing symbol breaks:

class TestNotifier < Noticed::Event
  deliver_by :fcm do |config|
    config.credentials = JSON.parse(Rails.application.credentials.firebase, symbolize_names: true)
    config.device_tokens = -> { recipient.devices.where(token_type: :firebase).pluck(:token) }
    config.queue = 'notifications'
    config.invalid_token = ->(device_token) { recipient.devices.find_by(token: device_token).destroy }
    config.json = :json_message
  end

  def json_message(device_token)
    {
      message: {
        token: device_token,
        notification: {
          title:,
          body:
        },
        w…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@ogirginc
Comment options

@ogirginc
Comment options

@ogirginc
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by ogirginc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants