RailsEventStore / rails_event_store

A Ruby implementation of an Event Store based on Active Record
http://railseventstore.org
MIT License
1.4k stars 121 forks source link

Document multiple databases support #937

Open mostlyobvious opened 3 years ago

mzanini commented 1 year ago

this. Was not able to make it work following instructions from this article. Code:

event_repository = RailsEventStoreActiveRecord::EventRepository.new(
    EventStoreBase, 
    serializer: RubyEventStore::NULL,
  )

Error:

Screenshot 2023-06-01 at 1 58 20 PM

Looks like we now have to pass a model_factory to point to another AR base class?

mpraglowski commented 1 year ago

Yep, you are right. The behavior described in blog post has changed in commit https://github.com/RailsEventStore/rails_event_store/commit/8a6e7c30a9b3a76c5565ab2eb48481bfdf9e3b69 (and later other changes).

The valid code now is:

  event_repository = RubyEventStore::ActiveRecord::EventRepository.new(
    model_factory: RubyEventStore::ActiveRecord::WithAbstractBaseClass.new(EventStoreBase), 
    serializer: RubyEventStore::NULL,
  )