Method: Bcms::WebDAV::Resource#exist?

Defined in:
lib/bcms_webdav/resource.rb

#exist?Boolean

This should always be called by DAV4Rack controller before any other primary operation (get, put) on a resource.

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/bcms_webdav/resource.rb', line 53

def exist?
  path_to_find = Resource.normalize_path(path)
  @section = Cms::Section.with_path(path_to_find).first

  if have_section
    log_exists('section', path_to_find)
    @resource = @section if have_section
  end

  @page = Cms::Page.with_path(path_to_find).first
  if have_page
    log_exists('page', path_to_find)
    @resource = @page
  end

  @file = Cms::Attachment.find_live_by_file_path(path)
  if have_file
    log_exists('file', path_to_find)
    @resource = @file
  end

  have_section || have_page || have_file
end