I am getting an application error when I try to use Dir.chdir in a layout <% Dir.chdir(''public'') %> The complete dump from development.log is listed below. When I try the same thing in the console, it works fine. Loading development environment.>> Dir.chdir(''public'')=> 0>>Any ideas on what the problem is, or how to fix it? Thanks Output from development.log ====================Processing LeagueController#index (for 71.74.192.170 at 2007-06-26 22:28:42) [GET] Session ID: c2618c4e3154c6d62f1c6dd055a9deb1 Parameters: {"action"=>"index", "controller"=>"league"} Errno::ENOENT (No such file or directory - script/../config/../tmp/ sessions//ruby_sess.6117ae9afe83d621): /usr/lib/ruby/1.8/pstore.rb:295:in `initialize'' /usr/lib/ruby/1.8/pstore.rb:295:in `open'' /usr/lib/ruby/1.8/pstore.rb:295:in `transaction'' /usr/lib/ruby/1.8/cgi/session/pstore.rb:81:in `update'' /usr/lib/ruby/1.8/cgi/session/pstore.rb:88:in `close'' /usr/lib/ruby/1.8/cgi/session.rb:324:in `close'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:1184:in `close_session'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:1228:in `process_cleanup_without_flash'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/flash.rb:146:in `process_cleanup_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:662:in `process_cleanup_without_session_management_support'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/session_management.rb:124:in `process_cleanup_without_components'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/components.rb:178:in `process_cleanup'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:435:in `process_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:624:in `process_without_session_management_support'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/session_management.rb:114:in `process'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:330:in `process'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in `dispatch'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb: 113:in `handle_dispatch'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb: 79:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb: 63:in `dispatch'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/ webrick.rb:59 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:495:in `require'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:342:in `new_constants_in'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:495:in `require'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/templates/rescues/layout.rhtml (500 Internal Error) No such file or directory - script/../config/../tmp/sessions// ruby_sess.6117ae9afe83d621 /usr/lib/ruby/1.8/pstore.rb:295:in `initialize'' /usr/lib/ruby/1.8/pstore.rb:295:in `open'' /usr/lib/ruby/1.8/pstore.rb:295:in `transaction'' /usr/lib/ruby/1.8/cgi/session/pstore.rb:81:in `update'' /usr/lib/ruby/1.8/cgi/session/pstore.rb:88:in `close'' /usr/lib/ruby/1.8/cgi/session.rb:324:in `close'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ base.rb:1184:in `close_session'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ base.rb:1228:in `process_cleanup_without_flash'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ flash.rb:146:in `process_cleanup_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ filters.rb:662:in `process_cleanup_without_session_management_support'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ session_management.rb:124:in `process_cleanup_without_components'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ components.rb:178:in `process_cleanup'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ base.rb:435:in `process_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ filters.rb:624:in `process_without_session_management_support'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ session_management.rb:114:in `process'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ base.rb:330:in `process'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in `dispatch'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:113:in `handle_dispatch'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:79:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:63:in `dispatch'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/ webrick.rb:59 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:495:in `require'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:342:in `new_constants_in'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:495:in `require'' /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
what do you get if do it like this: <% Dir.chdir( "#{RAILS_ROOT}/public" ) %> ? marcel On 27 Jun., 04:35, Ed <e...-OaR2BDvUfycwryQfseakQg@public.gmane.org> wrote:> I am getting an application error when I try to use Dir.chdir in a > layout > > <% Dir.chdir(''public'') %> > > The complete dump from development.log is listed below. > > When I try the same thing in the console, it works fine. > > Loading development environment. > > >> Dir.chdir(''public'') > => 0 > > Any ideas on what the problem is, or how to fix it? > > Thanks > > Output from development.log > ====================> Processing LeagueController#index (for 71.74.192.170 at 2007-06-26 > 22:28:42) [GET] > Session ID: c2618c4e3154c6d62f1c6dd055a9deb1 > Parameters: {"action"=>"index", "controller"=>"league"} > > Errno::ENOENT (No such file or directory - script/../config/../tmp/ > sessions//ruby_sess.6117ae9afe83d621): > /usr/lib/ruby/1.8/pstore.rb:295:in `initialize'' > /usr/lib/ruby/1.8/pstore.rb:295:in `open'' > /usr/lib/ruby/1.8/pstore.rb:295:in `transaction'' > /usr/lib/ruby/1.8/cgi/session/pstore.rb:81:in `update'' > /usr/lib/ruby/1.8/cgi/session/pstore.rb:88:in `close'' > /usr/lib/ruby/1.8/cgi/session.rb:324:in `close'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:1184:in `close_session'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:1228:in `process_cleanup_without_flash'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/flash.rb:146:in `process_cleanup_without_filters'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/filters.rb:662:in > `process_cleanup_without_session_management_support'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/session_management.rb:124:in > `process_cleanup_without_components'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/components.rb:178:in `process_cleanup'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:435:in `process_without_filters'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/filters.rb:624:in > `process_without_session_management_support'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/session_management.rb:114:in `process'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:330:in `process'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in > `dispatch'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb: > 113:in `handle_dispatch'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb: > 79:in `service'' > /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' > /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' > /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'' > /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' > /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'' > /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'' > /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'' > /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'' > /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb: > 63:in `dispatch'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/ > webrick.rb:59 > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require'' > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require'' > /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:495:in `require'' > /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:342:in `new_constants_in'' > /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:495:in `require'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require'' > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require'' > script/server:3 > > Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/templates/rescues/layout.rhtml (500 Internal Error) > No such file or directory - script/../config/../tmp/sessions// > ruby_sess.6117ae9afe83d621 > /usr/lib/ruby/1.8/pstore.rb:295:in `initialize'' > /usr/lib/ruby/1.8/pstore.rb:295:in `open'' > /usr/lib/ruby/1.8/pstore.rb:295:in `transaction'' > /usr/lib/ruby/1.8/cgi/session/pstore.rb:81:in `update'' > /usr/lib/ruby/1.8/cgi/session/pstore.rb:88:in `close'' > /usr/lib/ruby/1.8/cgi/session.rb:324:in `close'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ > base.rb:1184:in `close_session'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ > base.rb:1228:in `process_cleanup_without_flash'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ > flash.rb:146:in `process_cleanup_without_filters'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ > filters.rb:662:in `process_cleanup_without_session_management_support'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ > session_management.rb:124:in `process_cleanup_without_components'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ > components.rb:178:in `process_cleanup'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ > base.rb:435:in `process_without_filters'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ > filters.rb:624:in `process_without_session_management_support'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ > session_management.rb:114:in `process'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ > base.rb:330:in `process'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in > `dispatch'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:113:in > `handle_dispatch'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:79:in > `service'' > /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' > /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' > /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' > /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'' > /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' > /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'' > /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'' > /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'' > /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'' > /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:63:in > `dispatch'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/ > webrick.rb:59 > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require'' > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require'' > /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:495:in `require'' > /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:342:in `new_constants_in'' > /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ > dependencies.rb:495:in `require'' > /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require'' > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require'' > script/server:3--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jun 27, 2:15 am, lanzm <marcel.l...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> what do you get if do it like this: > > <% Dir.chdir( "#{RAILS_ROOT}/public" ) %> >This produces the same error. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
rails is looking for a session file relative to the current working directory, which is normally RAILS_ROOT. but when you did a chdir, you changed the current directory and now rails can''t find the session file it wants. answer is don''t change the working directory. why would you need to? On 6/28/07, Ed <ed-OaR2BDvUfycwryQfseakQg@public.gmane.org> wrote:> > On Jun 27, 2:15 am, lanzm <marcel.l...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > what do you get if do it like this: > > > > <% Dir.chdir( "#{RAILS_ROOT}/public" ) %> > > > > This produces the same error. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
meant to show an example Loading development environment.>> Dir.getwd=> "/home/chall/MyApp">> Dir.chdir(''public'')=> 0>> Dir.getwd=> "/home/chall/MyApp/public">> RAILS_ROOT=> "script/../config/../config/.." so now, if rails tries to load a file using RAILS_ROOT, it will look in /home/chall/MyApp/public/script/../config/../config/.. instead of /home/chall/MyApp/script/../config/../config/.. On 6/28/07, Chris Hall <christopher.k.hall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> rails is looking for a session file relative to the current working > directory, which is normally RAILS_ROOT. but when you did a chdir, > you changed the current directory and now rails can''t find the session > file it wants. > > answer is don''t change the working directory. why would you need to? > > On 6/28/07, Ed <ed-OaR2BDvUfycwryQfseakQg@public.gmane.org> wrote: > > > > On Jun 27, 2:15 am, lanzm <marcel.l...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > what do you get if do it like this: > > > > > > <% Dir.chdir( "#{RAILS_ROOT}/public" ) %> > > > > > > > This produces the same error. > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---