Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 9
- Log:
Reverting to the Tarball version of RForum. The prototype RISC OS Open
Ltd web site used a HEAD revision of RForum from RForum's SVN but this
specific revision was not recorded, so the changes are unknown. I'm
going to separately apply the current HEAD as a patch to the rolled
back Tarball revision, and apply the RISC OS Open Ltd site version as
a patch, then attempt to merge the latter to the former. If this fails
I'll revert to my original strategy - take the Tarball, commit HEAD,
then commit the web site version (which will implicitly revert to a
slightly earlier RForum version).
- Author:
- adh
- Date:
- Sat Jul 22 19:57:27 +0100 2006
- Size:
- 853 Bytes
1 | class Attachment < ActiveRecord::Base |
2 | belongs_to :post |
3 | |
4 | attr_writer :data |
5 | |
6 | include ErrorRaising |
7 | |
8 | def before_save |
9 | self.filename.gsub!(/[^a-z_\.\-0-9]/i, '_') |
10 | end |
11 | |
12 | def after_save |
13 | # Create attachment directory |
14 | begin |
15 | Dir.mkdir(self.dir_path) |
16 | rescue Errno::EEXIST |
17 | end |
18 | # Save uploaded file to attachment directory |
19 | File.open(self.file_path, 'w') do |f| |
20 | f.write(@data) |
21 | end |
22 | end |
23 | |
24 | def after_destroy |
25 | # Delete file |
26 | File.delete self.file_path |
27 | # Delete directory |
28 | Dir.delete self.dir_path |
29 | end |
30 | |
31 | # Returns the directory of this attachment, e.g. /rails/public/attachments/12/ |
32 | def dir_path |
33 | RAILS_ROOT + RForum::CONFIG[:attachment_path] + "/#{self.id}/" |
34 | end |
35 | |
36 | def file_path |
37 | self.dir_path + self.filename |
38 | end |
39 | |
40 | def get_file_content |
41 | File.read self.file_path |
42 | end |
43 | |
44 | |
45 | end |