29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/dm-fasten-the-seat-belt.rb', line 29
def fasten_the_seat_belt(options={})
self.property :filename, String
self.property :size, Integer, :lazy => true
self.property :content_type, String, :lazy => true
self.property :created_at, DateTime, :lazy => true
self.property :updated_at, DateTime, :lazy => true
self.property :images_are_compressed, DataMapper::Types::Boolean, :lazy => true
before :save, :save_attributes
after :save, :save_file
after :destroy, :delete_directory
if !defined?(Merb) && !options[:file_system_path]
raise "If you're running dm-fasten-the-seat-belt outside of Merb, you must specifiy :file_system_path in the options"
end
options[:file_system_path] ||= File.join((defined?(Merb) ? Merb.root : ''), 'public', merb_environment, self.storage_name)
options[:thumbnails] ||= {}
self.fasten_the_seat_belt_options = options
end
|