0.0
No release in over 3 years
Description of RailsNotice.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

<= 6.0, >= 5.0
 Project Readme

RailsNotice

测试 Docker构建 Gem

RailsNotice 用于处理通告(Annunciation),消息(Notification);

特性

  • 只在用户请求数据时快速生成通知记录,避免僵尸用户产生的死数据;

Usage

Set the cable.yml

Should set adapter as redis in development

development:
  adapter: redis
  url: redis://localhost:6379/1

Import the js and css in the page which you want show notifications

<%= javascript_include_tag 'rails_notice/notice_channel', 'data-turbolinks-eval': 'false' %>
<%= stylesheet_link_tag 'rails_notice/cable' %>

View: add link

<%= render 'notice_link' %>

Model Setting

# which model can receive notifications
class User < ApplicationRecord
  include Notice::Ext::Receiver
end

Controller Setting

class ApplicationController < ActionController::Base
  include RailsNotice::Application
  
end

Channel Setting

module ApplicationCable
  class Connection < ActionCable::Connection::Base
    prepend RailsNoticeConnection

  end
end

许可证

遵循 MIT 协议