public
Description: Treat an ActiveRecord model as a file attachment, storing its patch, size, content type, etc.
Homepage: http://weblog.techno-weenie.net
Clone URL: git://github.com/technoweenie/attachment_fu.git
Click here to lend your support to: attachment_fu and make a donation at www.pledgie.com !
AttachmentFu#public_path should leave public/ out of the path
rick (author)
Mon Apr 28 17:46:59 -0700 2008
commit  2e3736bccb05c870f4942bf177bd58e39ebcc620
tree    c93945190669629c9e64703fd12dec38672f6e46
parent  e19754b2143604c08cd0a9a8dbc5b889205b3f99
...
156
157
158
159
 
160
161
162
163
164
 
165
166
167
...
156
157
158
 
159
160
161
162
163
 
164
165
166
167
0
@@ -156,12 +156,12 @@ module AttachmentFu
0
     end
0
 
0
     def public_path(*args)
0
- File.join(attachment_path, *partitioned_path(*args))
0
+ File.join(attachment_path, *partitioned_path(*args)).sub(/^public\//, '')
0
     end
0
 
0
     def full_path(*args)
0
       return nil if attachment_path_id.nil?
0
- File.expand_path(File.join(AttachmentFu.root_path, public_path(*args)))
0
+ File.expand_path(File.join(AttachmentFu.root_path, attachment_path, *partitioned_path(*args)))
0
     end
0
 
0
     # Sets the path to the attachment about to be saved. Could be a string path to a file,
...
65
66
67
68
69
 
 
70
71
72
...
65
66
67
 
 
68
69
70
71
72
0
@@ -65,8 +65,8 @@ module AttachmentFu
0
       end
0
 
0
       it "creates public_path from record id and attachment_path" do
0
- @asset.public_path.should == "public/afu_spec_assets/#{@asset.partitioned_path * '/'}"
0
- @asset.public_path("foo", "bar").should == "public/afu_spec_assets/#{@asset.partitioned_path * '/'}/foo/bar"
0
+ @asset.public_path.should == "afu_spec_assets/#{@asset.partitioned_path * '/'}"
0
+ @asset.public_path("foo", "bar").should == "afu_spec_assets/#{@asset.partitioned_path * '/'}/foo/bar"
0
       end
0
 
0
       it "creates partitioned path from the record id" do

Comments

    No one has commented yet.