- 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
- Add an initializer to setup the default watcher object:
Watch.configure do |configuration|
configuration.watcher = -> (context) { current_user }
end
- Add this snippet to
routes.rb
:
mount Watch::Engine, at: '/'
- Add this snippet to
application_controller.rb
:
helper Watch::Engine.helpers
- For every watcher object include the following:
class User < ActiveRecord::Base
include Watch::Watcher
end
- For every watchable object include the following:
class Firm < ActiveRecord::Base
include Watch::Watchable
end
- Views can be modified to use the bundled react component:
<%= firm.name %>
<%= react_watch_widget(firm) %>