Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/ioki.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,13 @@ def config
def configure
yield(config)
end

def deprecator
@deprecator ||= if defined?(Rails)
ActiveSupport::Deprecation.new('1.0', 'Ioki')
else
Kernel
end
end
end
end
10 changes: 1 addition & 9 deletions lib/ioki/model/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,7 @@ def attribute_deprecated?(attribute)
end

def deprecation_warning(message)
if defined?(Rails)
deprecator.warn(message)
else
warn message
end
end

def deprecator
@deprecator ||= ActiveSupport::Deprecation.new('1.0', 'Ioki')
Ioki.deprecator.warn(message)
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions lib/ioki/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ class Railtie < ::Rails::Railtie
ActiveSupport.on_load(:action_mailer) do
add_delivery_method :ioki, Ioki::Mailing::Mailer
end

initializer 'ioki.deprecator' do |app|
app.deprecators[:ioki] = Ioki.deprecator
end
end
end