我有一个模式,利用纸张管理档案。
在我删除该模式之后,我显然希望删除该档案,但我似乎无法找到如何用纸张删除该档案。
我尝试了<代码>自行.sourcefile = nil if !sourcefile。 dirty? in before_destroy
否则就没有效果。
(在我测试时,我希望能够在当地删除档案,然后在我使用时删除S3——因此,我需要纯粹纸面解决办法)
任何想法?
我有一个模式,利用纸张管理档案。
在我删除该模式之后,我显然希望删除该档案,但我似乎无法找到如何用纸张删除该档案。
我尝试了<代码>自行.sourcefile = nil if !sourcefile。 dirty? in before_destroy
否则就没有效果。
(在我测试时,我希望能够在当地删除档案,然后在我使用时删除S3——因此,我需要纯粹纸面解决办法)
任何想法?
纸面记录在未能删除档案时就显得无意义。
如果没有任何特殊配置,如果你删除物体,有关档案(如果有的话)也将删除,这一点在记录中(至少在发展模式中)指出:
[paperclip] Deleting attachments.
[paperclip] deleting /clipper/public/system/avatars/3/original/whatever.JPG
如果纸面文件无法删除档案,那么它就将只是一个例外。
所有这些都经过了最新的纸浆测试(于5月25日从金字塔中入)。 如果你有较老的版本,你可能希望更新,那么在观察这些记录时会进行一些测试。
我可能错了,但我认为,它应当自has_attadated_file
以来自动这样做。
Edit:如果你不工作,也许你会试图打上<条码>destroy_attabed_files,这似乎对我很不满意。 。
collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...
We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...
As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...
I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?
I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...
I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml
guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...
I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...