I haven''t actually tried it yet, but I think switchtower conflicts somewhat with file_column. file_column puts uploads in the public directory. But when you do a ''rake deploy'' with switchtower, then the files that were in the public directory aren''t used by the newly released svn export of your site (because a new public directory is created). What''s the easiest way around this issue? Thanks, Joe
On 12/10/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I haven''t actually tried it yet, but I think switchtower conflicts > somewhat with file_column. > > file_column puts uploads in the public directory. But when you do a > ''rake deploy'' with switchtower, then the files that were in the public > directory aren''t used by the newly released svn export of your site > (because a new public directory is created). > > What''s the easiest way around this issue? > > Thanks, > JoeCreate the upload directory in shared and then an after_symlink callback in switchtower that links it into public/uploads. -- rick http://techno-weenie.net
I store my file_column database outside of the app path. I also include the rails environment in the path. You don''t need to do this, but I consider it a best practice. To include the rails environment in your file_column path, set the following file_column options: :root_path => File.join(RAILS_ROOT, "public", RAILS_ENV), :web_root => RAILS_ENV + "/" If you want to do this globally, you can patch the source (look for "DEFAULT_OPTIONS"), or you can pass it like: file_column :field, options. Here''s the gist of my folder structure: /u/apps/myapp/ /u/file_column_db/myapp/production/ Then, I modifed my deploy.rb file to include the following in the restart task (another task may be more appropriate, but this works) sudo "ln -s /u/file_column_db/myapp/production /u/apps/myapp/current/public/production" Of course, you need to set the appropriate permissions on everything... On 12/10/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I haven''t actually tried it yet, but I think switchtower conflicts > somewhat with file_column. > > file_column puts uploads in the public directory. But when you do a > ''rake deploy'' with switchtower, then the files that were in the public > directory aren''t used by the newly released svn export of your site > (because a new public directory is created). > > What''s the easiest way around this issue? > > Thanks, > Joe > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On 12/10/05, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 12/10/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I haven''t actually tried it yet, but I think switchtower conflicts > > somewhat with file_column. > > > > file_column puts uploads in the public directory. But when you do a > > ''rake deploy'' with switchtower, then the files that were in the public > > directory aren''t used by the newly released svn export of your site > > (because a new public directory is created). > > > > What''s the easiest way around this issue? > > Create the upload directory in shared and then an after_symlink > callback in switchtower that links it into public/uploads.So, if files are normally stored in public/training_event, I''d create a directory shared/uploads/training_event and symlink that to public/training_event?
On 12/10/05, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 12/10/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I haven''t actually tried it yet, but I think switchtower conflicts > > somewhat with file_column. > > > > file_column puts uploads in the public directory. But when you do a > > ''rake deploy'' with switchtower, then the files that were in the public > > directory aren''t used by the newly released svn export of your site > > (because a new public directory is created). > > > > What''s the easiest way around this issue? > > Create the upload directory in shared and then an after_symlink > callback in switchtower that links it into public/uploads.I have current/public/training_event symlinked to shared/uploads/training_event. Here''s the error I get when I try to load anything: Errno::EEXIST in <controller not set>#<action not set> File exists - /home/joevd/cisv/current/public/../config/../public/training_event RAILS_ROOT: /home/joevd/cisv/current/public/../config/.. Application Trace | Framework Trace | Full Trace /usr/local/lib/ruby/1.8/fileutils.rb:212:in `mkdir'' /usr/local/lib/ruby/1.8/fileutils.rb:212:in `fu_mkdir'' /usr/local/lib/ruby/1.8/fileutils.rb:193:in `mkpath'' /usr/local/lib/ruby/1.8/fileutils.rb:191:in `reverse_each'' /usr/local/lib/ruby/1.8/fileutils.rb:191:in `mkpath'' /usr/local/lib/ruby/1.8/fileutils.rb:177:in `each'' /usr/local/lib/ruby/1.8/fileutils.rb:177:in `mkpath'' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column.rb:29:in `init_options'' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column.rb:28:in `each'' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column.rb:28:in `init_options'' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column.rb:594:in `file_column'' #{RAILS_ROOT}/app/models/training_event.rb:11 (eval):5:in `belongs_to'' #{RAILS_ROOT}/app/models/registration.rb:2 (eval):5:in `has_many'' #{RAILS_ROOT}/app/models/user.rb:13 #{RAILS_ROOT}/app/controllers/application.rb:9 This error occured while loading the following files: /home/joevd/cisv/current/public/../config/../app/controllers/application.rb => model user.rb user registration training_event
> > > file_column puts uploads in the public directory. But when you do a > > > ''rake deploy'' with switchtower, then the files that were in the public > > > directory aren''t used by the newly released svn export of your site > > > (because a new public directory is created). > > > > > > What''s the easiest way around this issue? > > > > Create the upload directory in shared and then an after_symlink > > callback in switchtower that links it into public/uploads. > > I have current/public/training_event symlinked to shared/uploads/training_event. > > Here''s the error I get when I try to load anything: > > Errno::EEXIST in <controller not set>#<action not set> > > File exists - /home/joevd/cisv/current/public/../config/../public/training_event > RAILS_ROOT: /home/joevd/cisv/current/public/../config/..hmm, that''s strange, because I''m using FileUtils.mkpath, which creates all the directories if they aren''t there already but shouldn''t complain if it already exists. I''m wondering if it has troubles with the symlinks. Can anybody shed some light on this? Sebastian
On Dec 11, 2005, at 7:23 AM, Sebastian Kanthak wrote:>>>> file_column puts uploads in the public directory. But when you >>>> do a >>>> ''rake deploy'' with switchtower, then the files that were in the >>>> public >>>> directory aren''t used by the newly released svn export of your site >>>> (because a new public directory is created). >>>> >>>> What''s the easiest way around this issue? >>> >>> Create the upload directory in shared and then an after_symlink >>> callback in switchtower that links it into public/uploads. >> >> I have current/public/training_event symlinked to shared/uploads/ >> training_event. >> >> Here''s the error I get when I try to load anything: >> >> Errno::EEXIST in <controller not set>#<action not set> >> >> File exists - /home/joevd/cisv/current/public/../config/../public/ >> training_event >> RAILS_ROOT: /home/joevd/cisv/current/public/../config/.. > > hmm, that''s strange, because I''m using FileUtils.mkpath, which creates > all the directories if they aren''t there already but shouldn''t > complain if it already exists. I''m wondering if it has troubles with > the symlinks. Can anybody shed some light on this?Actually, FileUtils.mkdir_p will act as you describe. FileUtils.mkdir will choke if the path already exists. - Jamis