Last active
May 6, 2016 15:21
-
-
Save macejmic/2f9b5531c9633beb806f96a728daab91 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/events/applications/application_created_event.rb b/app/events/applications/application_created_event.rb | |
index 29afbca..8f62278 100644 | |
--- a/app/events/applications/application_created_event.rb | |
+++ b/app/events/applications/application_created_event.rb | |
@@ -1,4 +1,15 @@ | |
class Applications::ApplicationCreatedEvent < RailsEventStore::Event | |
+ | |
+ def self.belongs_to(association) | |
+ define_method "find_#{association}" do | |
+ association.to_s.camelize.constantize.find(__send__("#{association}_id")) | |
+ end | |
+ end | |
+ | |
+ belongs_to :provider | |
+ belongs_to :service | |
+ belongs_to :plan | |
+ | |
# @param [Cinstance] application | |
def self.create(application) | |
new( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment