Sha256: cc82ac01bd843d7cf731fbd3e7c1399b6759a5e8492b54b5becdc2e27a2e5041

Contents?: true

Size: 836 Bytes

Versions: 24

Compression:

Stored size: 836 Bytes

Contents

class Ckeditor::Asset < ActiveRecord::Base
  set_table_name "ckeditor_assets"
  
  belongs_to :user
  belongs_to :assetable, :polymorphic => true
  
  scope :masters, where("parent_id IS NULL")
  
  def url(*args)
    public_filename(*args)
  end
  
  def format_created_at
    I18n.l(self.created_at, :format=>"%d.%m.%Y %H:%M")
  end
  
  def to_xml(options = {})
    xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])

    xml.tag!(self.read_attribute(:type).to_s.downcase) do
      xml.filename{ xml.cdata!(self.filename) }
      xml.size self.size
      xml.path{ xml.cdata!(self.public_filename) }
      
      xml.thumbnails do
        self.thumbnails.each do |t|
          xml.tag!(t.thumbnail, self.public_filename(t.thumbnail))
        end
      end unless self.thumbnails.empty?
    end
  end
end

Version data entries

24 entries across 24 versions & 5 rubygems

Version Path
ckeditor-3.4.0.pre lib/generators/ckeditor/migration/templates/models/attachment_fu/asset.rb
ckeditor-3.3.2 generators/ckeditor_migration/templates/models/attachment_fu/asset.rb
ckeditor-3.2.4 lib/generators/templates/models/attachment_fu/asset.rb
ckeditor-3.2.3 lib/generators/templates/models/attachment_fu/asset.rb