Class Storage
In: app/models/storage.rb
Parent: ActiveRecord::Base

添付ファイルを保存するサーバのモデル。

Methods

Public Class methods

現在のユーザーに関連するインスタンスを返す。

[Source]

    # File app/models/storage.rb, line 27
27:   def self.current
28:     if u = User.current
29:       if s = u.person.domain.storage
30:         return s
31:       end
32:     end
33:     r = Pathname.new(RAILS_ROOT) + "tmp"
34:     return Storage.new(:root => r.to_s, :separator => "/")
35:   end

Public Instance methods

保存場所として利用可能かどうかを判定する。

[Source]

    # File app/models/storage.rb, line 38
38:   def available?
39:     !root.blank? && File.exist?(root) && (File.stat(root) == "directory")
40:   end

[Validate]