Sha256: cf3d27724e5d74bf51cc569501858acf862723cd044e5a7d4e503270bf3284e3

Contents?: true

Size: 566 Bytes

Versions: 250

Compression:

Stored size: 566 Bytes

Contents

class Caboose::Asset < ActiveRecord::Base
  self.table_name = "assets"
  belongs_to :page
  attr_accessible :page_id, :uploaded_by_id, :date_uploaded, :name, :filename, :description, :extension

  def sanitize_name(str)
    return str.gsub(' ', '_').downcase 
  end
  
  def assets_with_uri(uri)
    uri[0] = '' if uri.start_with? '/'
    
		page = Page.page_with_uri(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

end

Version data entries

250 entries across 250 versions & 1 rubygems

Version Path
caboose-cms-0.4.42 app/models/caboose/asset.rb
caboose-cms-0.4.41 app/models/caboose/asset.rb
caboose-cms-0.4.40 app/models/caboose/asset.rb
caboose-cms-0.4.39 app/models/caboose/asset.rb
caboose-cms-0.4.38 app/models/caboose/asset.rb
caboose-cms-0.4.37 app/models/caboose/asset.rb
caboose-cms-0.4.36 app/models/caboose/asset.rb
caboose-cms-0.4.35 app/models/caboose/asset.rb
caboose-cms-0.4.34 app/models/caboose/asset.rb
caboose-cms-0.4.33 app/models/caboose/asset.rb
caboose-cms-0.4.32 app/models/caboose/asset.rb
caboose-cms-0.4.31 app/models/caboose/asset.rb
caboose-cms-0.4.30 app/models/caboose/asset.rb
caboose-cms-0.4.29 app/models/caboose/asset.rb
caboose-cms-0.4.28 app/models/caboose/asset.rb
caboose-cms-0.4.27 app/models/caboose/asset.rb
caboose-cms-0.4.26 app/models/caboose/asset.rb
caboose-cms-0.4.25 app/models/caboose/asset.rb
caboose-cms-0.4.24 app/models/caboose/asset.rb
caboose-cms-0.4.23 app/models/caboose/asset.rb