Class: Caboose::Asset

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/caboose/asset.rb

Instance Method Summary collapse

Instance Method Details

#assets_with_uri(host_with_port, uri) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/caboose/asset.rb', line 11

def assets_with_uri(host_with_port, uri)
   uri[0] = '' if uri.start_with? '/'
   
	page = Page.page_with_uri(host_with_port, File.dirname(uri), false)		
	return false if page.nil?
	
	asset = Asset.where(:page_id => page.id,:filename => File.basename(uri)).first
	return false if asset.nil?
	
	return asset
end

#sanitize_name(str) ⇒ Object



7
8
9
# File 'app/models/caboose/asset.rb', line 7

def sanitize_name(str)
  return str.gsub(' ', '_').downcase 
end