Skip to content

Commit 5c31e3c

Browse files
committed
Fix exception caused when marshalling models
Exception: no _dump_data is defined for class Proc
1 parent c5580f4 commit 5c31e3c

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

lib/ioki.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,13 @@ def config
3434
def configure
3535
yield(config)
3636
end
37+
38+
def deprecator
39+
@deprecator ||= if defined?(Rails)
40+
ActiveSupport::Deprecation.new('1.0', 'Ioki')
41+
else
42+
Kernel
43+
end
44+
end
3745
end
3846
end

lib/ioki/model/base.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -340,15 +340,7 @@ def attribute_deprecated?(attribute)
340340
end
341341

342342
def deprecation_warning(message)
343-
if defined?(Rails)
344-
deprecator.warn(message)
345-
else
346-
warn message
347-
end
348-
end
349-
350-
def deprecator
351-
@deprecator ||= ActiveSupport::Deprecation.new('1.0', 'Ioki')
343+
Ioki.deprecator.warn(message)
352344
end
353345
end
354346
end

lib/ioki/railtie.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ class Railtie < ::Rails::Railtie
88
ActiveSupport.on_load(:action_mailer) do
99
add_delivery_method :ioki, Ioki::Mailing::Mailer
1010
end
11+
12+
initializer 'ioki.deprecator' do |app|
13+
app.deprecators[:ioki] = Ioki.deprecator
14+
end
1115
end
1216
end

0 commit comments

Comments
 (0)