diff --git a/lib/fog/core/attributes.rb b/lib/fog/core/attributes.rb index ceadc8c3e..3abd63232 100644 --- a/lib/fog/core/attributes.rb +++ b/lib/fog/core/attributes.rb @@ -152,8 +152,25 @@ module Fog self end + # Returns true if a remote resource has been assigned an + # identity and we can assume it has been persisted. + # + # @return [Boolean] + def persisted? + !!identity + end + + # Returns true if a remote resource has not been assigned an + # identity. + # + # This was added for a ActiveRecord like feel but has been + # outdated by ActiveModel API using {#persisted?} + # + # @deprecated Use inverted form of {#persisted?} + # @return [Boolean] def new_record? - !identity + Fog::Logger.deprecation("#new_record? is deprecated, use !persisted? instead [light_black](#{caller.first})[/]") + !persisted? end # check that the attributes specified in args exist and is not nil