dimanche 9 décembre 2018

Notification System in Rails using PublicActivity

I want to notify users when the email is sent to them using action mailer. So for that i have gemPublicActivity Not understanding how to proceed if some one can help it would be helpful.

class MailingQueue < ApplicationRecord
  include PublicActivity::Model
  tracked
  belongs_to :startup
end

class EmailJob < ApplicationJob
  queue_as :default
   def perform(investor_users)
    investor_users.find_each do |user|
       UserMailer.send_email(user).deliver_now
    end
  end
end

When usermailer function is performed in my dashboard I need to show the notification that a new mail is been received.

Dashboard controller

class DashboardController < ApplicationController
  before_action :authenticate_user!,:set_user, except: [:filter_by_sectors]
  skip_before_action :verify_authenticity_token, only: [:filter_by_sectors]

  def sector_interest_mentors
    @startups = Startup.paginate(:page => params[:page], :per_page => 4)
    @sectors = Sector.all.order('name ASC').group_by{|d| d.name[0]}
  end
end

Aucun commentaire:

Enregistrer un commentaire