Installation with Bundler

If your application dependencies happen to be managed by Bundler, please add the following line to your Gemfile:

gem "rails_event_store"

After running bundle install, Rails Event Store should be ready to be used.

Installation using RubyGems

You can also install this library using the gem command:

gem install rails_event_store

After requiring rubygems in your project you should be ready to use Rails Event Store.

Setup data model

Use provided task to generate a table to store events in your database.

rails generate rails_event_store_active_record:migration
rake db:migrate

Working with Rails development mode

In Rails development mode when you change a registered class, it is reloaded, and a new class with same name is constructed. To keep RailsEventStore aware of changes in handler classes, and handler subscriptions use to_prepare callback. It is executed before every code reload in development, and once in production.

# config/environments/*.rb

Rails.application.configure do
  config.to_prepare do
    config.event_store =

Then in your application code you can reference it as: