Skip to content

Commit

Permalink
deprecation warning needs to be tested
Browse files Browse the repository at this point in the history
  • Loading branch information
bf4 committed Jan 7, 2017
1 parent a9fe682 commit bb0ddca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/active_model_serializers/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def self.inherited(subclass)
if subclass.attributes_are_always_the_initialization_data
unless subclass.included_modules.include?(AttributesAreAlwaysTheInitializationData)
subclass.prepend(AttributesAreAlwaysTheInitializationData)

deprecated_method = :attributes_are_always_the_initialization_data
target = is_a?(Module) ? "#{self}." : "#{self.class}#"
msg = ["NOTE: #{target}#{deprecated_method} is deprecated with no replacement",
"\n#{target}#{deprecated_method} called from #{ActiveModelSerializers.location_of_caller.join(':')}"]
warn "#{msg.join}."
end
end
super
Expand Down

0 comments on commit bb0ddca

Please sign in to comment.