From 9cbb5323f63f159a0087b2feee0f62b056e44a48 Mon Sep 17 00:00:00 2001 From: Kevin Curtin Date: Wed, 25 Jun 2014 14:21:41 -0400 Subject: [PATCH] Add monkey patch to statemachine to make #around_validation public (https://github.com/pluginaweek/state_machine/issues/295) --- lib/has_messages.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/has_messages.rb b/lib/has_messages.rb index 5772978..4a911c6 100644 --- a/lib/has_messages.rb +++ b/lib/has_messages.rb @@ -1,4 +1,16 @@ require 'state_machine' +# Rails 4.1.0.rc1 and StateMachine don't play nice +# https://github.com/pluginaweek/state_machine/issues/295 +require 'state_machine/version' +unless StateMachine::VERSION == '1.2.0' + # If you see this message, please test removing this file + # If it's still required, please bump up the version above + puts "Please remove me, StateMachine version has changed" +end + +module StateMachine::Integrations::ActiveModel + public :around_validation +end # Adds a generic implementation for sending messages between users module HasMessages @@ -76,7 +88,7 @@ def sent_messages messages.with_states(:queued, :sent) end end - + module ActsAsMessageTopicInstanceMethods def topical_messages_for(receiver, recipient_state = nil) recipients_filter = MessageRecipient.with_receiver(receiver)