| Class | BinaryObject |
| In: |
app/models/binary_object.rb
|
| Parent: | ActiveRecord::Base |
複写機能のためのコピーを返す。失敗した場合は false を返す。
# File app/models/binary_object.rb, line 47
47: def copy
48: copied = self.class.new
49: copied.attributes = attributes
50: return copied.save && copied
51: end
保存先を表す文字列を返す。
# File app/models/binary_object.rb, line 30
30: def location
31: s_("BinaryObject|Database")
32: end
アップロードされたファイル x を保存する。
# File app/models/binary_object.rb, line 35
35: def store(x)
36: self.content = x.read
37: if x.is_a?(Tempfile)
38: self.length = File::size(x.local_path)
39: else
40: self.length = self.content.size
41: end
42: ConfigAttachment.current.validate_length(self.length)
43: return save
44: end