Skip to content

Rails engine enables Watch/Follow functionality between models including options to track views and trigger change notifications

License

Notifications You must be signed in to change notification settings

moonlight-labs/watch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Watch

Setup

  1. Add the plugin to your gemfile and install the migrations:
gem 'watch', git: 'grantiq/watch'
bundle
bundle exec rake watch:install:migrations
bundle exec rake db:migrate
  1. Add an initializer to setup the default watcher object:
Watch.configure do |configuration|
  configuration.watcher = -> (context) { current_user }
end
  1. Add this snippet to routes.rb:
  mount Watch::Engine, at: '/'
  1. Add this snippet to application_controller.rb:
helper Watch::Engine.helpers
  1. For every watcher object include the following:
class User < ActiveRecord::Base
  include Watch::Watcher
end
  1. For every watchable object include the following:
class Firm < ActiveRecord::Base
  include Watch::Watchable
end
  1. Views can be modified to use the bundled react component:
<%= firm.name %>
<%= react_watch_widget(firm) %>

About

Rails engine enables Watch/Follow functionality between models including options to track views and trigger change notifications

Resources

License

Stars

Watchers

Forks

Packages

No packages published