From 3c1f86a5e538a6955aac19256bebcec344e5032c 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 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/has_messages.rb b/lib/has_messages.rb index 5772978..e853617 100644 --- a/lib/has_messages.rb +++ b/lib/has_messages.rb @@ -1,4 +1,15 @@ require 'state_machine' +# Rails 4.1.0.rc1 and StateMachine don't play nice +# https://github.com/pluginaweek/state_machine/issues/295 +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 +87,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)