exists?(id, options = {})
public
Asserts the existence of a resource, returning true if the
resource is found.
Examples
Note.create(:title => 'Hello, world.', :body => 'Nothing more for now...')
Note.exists?(1)
Note.exists(1349)
# File activeresource/lib/active_resource/base.rb, line 551
def exists?(id, options = {})
if id
prefix_options, query_options = split_options(options[:params])
path = element_path(id, prefix_options, query_options)
response = connection.head(path, headers)
response.code.to_i == 200
end
# id && !find_single(id, options).nil?
rescue ActiveResource::ResourceNotFound
false
end