I am trying to get attachment_fu to store files in a separate directory tree, so that when I use Capistrano to update the site the ''public/files'' directory doesnt get left behind, thus losing the previously uploaded files. So I have redefined full_filename from attachment_fu to use ''/usr/home/ sitename/files'' as the tree root, then the model may add a :path_prefix. But it doesnt seem to work..... I say seem because attachment_fu IS putting the file somewhere, as I can get it back on the display page.....but where it is going is a mystery. The files are NOT in public/* nor are they in /usr/home/sitename/files/ * ..... I have tried putting the full_filename rewrite in both the model rfc.rb (which seems to be the logical place) and alternately in the appropriate controller i.e. rfc_controller.rb I am still quite a newbie so me understanding what to test from the console is approaching zero. Am I approaching this from the correct direction, or is there some other method to use? mjt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
JN_Coward
2007-Jul-19 07:11 UTC
Re: Cant get attachment_fu to store files outside of RAILS_ROOT
hi,
personally I always symlink the directories the files are uploaded to
from my current, to my shared with an after_update_code (adjust for
cap2):
task :after_update_code do
%w{avatars logo polaroids}.each do |share|
run "ln -nfs #{shared_path}/#{share} #{release_path}/public/images/
#{share}"
end
run "ln -nfs #{shared_path}/db/production.sqlite3 #{release_path}/db/
production.sqlite3"
run "ln -nfs #{shared_path}/index #{release_path}/index"
end
like that. I read this in a blog post somewhere, so credit is not
mine.
Imho, this is a better solution than uploading outside RAILS_ROOT,
since it also works in dev and is much less hackish.
/Jonas
On 19 Juli, 14:14, mjt <mtay...-333TOtzy3TIW+bLBXbPJGg@public.gmane.org>
wrote:> I am trying to get attachment_fu to store files in a separate
> directory tree, so that when I use Capistrano to update the site the
> ''public/files'' directory doesnt get left behind, thus
losing the
> previously uploaded files.
>
> So I have redefined full_filename from attachment_fu to use
''/usr/home/
> sitename/files'' as the tree root, then the model may add
> a :path_prefix.
>
> But it doesnt seem to work..... I say seem because attachment_fu IS
> putting the file somewhere, as I can get it back on the display
> page.....but where it is going is a mystery.
>
> The files are NOT in public/* nor are they in /usr/home/sitename/files/
> * .....
>
> I have tried putting the full_filename rewrite in both the model
> rfc.rb (which seems to be the logical place) and alternately in the
> appropriate controller i.e. rfc_controller.rb
>
> I am still quite a newbie so me understanding what to test from the
> console is approaching zero.
>
> Am I approaching this from the correct direction, or is there some
> other method to use?
>
> mjt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
fernando
2007-Aug-17 18:34 UTC
Re: Cant get attachment_fu to store files outside of RAILS_ROOT
I used a capistrano recipie to copy the uploaded files out of my application before updating the code then copied them all back afterwards. see: http://groups.google.co.uk/group/rubyonrails-talk/browse_thread/thread/8bf142e132dcf0f4/902e96d5120b1ec3?hl=en On 19 Jul, 08:11, JN_Coward <jonas.nick...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> hi, > personally I always symlink the directories the files are uploaded to > from my current, to my shared with an after_update_code (adjust for > cap2): > > task :after_update_code do > %w{avatars logo polaroids}.each do |share| > run "ln -nfs #{shared_path}/#{share} #{release_path}/public/images/ > #{share}" > end > run "ln -nfs #{shared_path}/db/production.sqlite3 #{release_path}/db/ > production.sqlite3" > run "ln -nfs #{shared_path}/index #{release_path}/index" > end > > like that. I read this in a blog post somewhere, so credit is not > mine. > > Imho, this is a better solution than uploadingoutsideRAILS_ROOT, > since it also works in dev and is much less hackish. > > /Jonas > > On 19 Juli, 14:14, mjt <mtay...-333TOtzy3TIW+bLBXbPJGg@public.gmane.org> wrote: > > > I am trying to get attachment_fu to store files in a separate > > directory tree, so that when I use Capistrano to update the site the > > ''public/files'' directory doesnt get left behind, thus losing the > > previously uploaded files. > > > So I have redefined full_filename from attachment_fu to use ''/usr/home/ > > sitename/files'' as the treeroot, then the model may add > > a :path_prefix. > > > But it doesnt seem to work..... I say seem because attachment_fu IS > > putting the file somewhere, as I can get it back on the display > > page.....but where it is going is a mystery. > > > The files are NOT in public/* nor are they in /usr/home/sitename/files/ > > * ..... > > > I have tried putting the full_filename rewrite in both the model > > rfc.rb (which seems to be the logical place) and alternately in the > > appropriate controller i.e. rfc_controller.rb > > > I am still quite a newbie so me understanding what to test from the > > console is approaching zero. > > > Am I approaching this from the correct direction, or is there some > > other method to use? > > > mjt--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---