pushable-rails
Send model updates to Pusher
Installation
Add this line to your application's Gemfile:
gem 'pushable-rails', require: 'pushable'
And then execute:
$ bundle
Usage
Include the Pushable
module in your activerecord models like this:
class DummyModel < ActiveRecord::Base
include Pushable
end
Now every time you create, update or destroy DummyModel
s your app will send the corresponding notifications to pusher.
Channel: pusher
Events:
Create
dummy_model.destroy
Update
dummy_model.update
Destroy
dummy_model.destroy
The payload will be the output of the model instance to_json
. If defined, a serializer will be used (eg. DummyModelSerializer
).
Contributing
- Fork it ( http://github.com/
/pushable-rails/fork ) - Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request