The chdir line is almost certainly wrong - going to RAILS_ROOT would be much more reliable.
I'm also unsure what a novice programmer is doing shelling out to a 2.5 year old version of Rake. Is there some reason why you're stuck on 0.7.3? Hardcoding the path to the redirect is also incorrect - you'll probably want something more like "redirect_to '/admin'", which will work even if the app isn't running on localhost... Finally, the entire premise here seems a little off - you haven't mentioned what's in the cache dir that you want to clear out, but there are much better ways of handling it in most circumstances. Take a look at the framework docs for ActionController::Caching (specifically, sweepers and friends). --Matt Jones On Aug 11, 1:33 pm, Michael Wright <[email protected]> wrote: > hello, > > I am new to programming and am trying to create a clear_cache method. > This method is invoked when a submit button is pressed on a partial. > > def clear_cache > Dir.chdir('../../../../../') #This moves up to the appropriate > directory > system('rake _0.7.3_ tmp:cache:clear') > redirect_to 'http://127.0.0.1:3000/admin' > end > > The method is certainly being invoked as the redirect is working fine, > however, the method skips over the first two lines, no error messages > are appearing but the cache is not being cleared. if this method is > invoked in a seperate file in the same directory, using a call to the > method and the f5 button, the cache is clearing. > > def clear_cache > Dir.chdir('../../../../../') > system('rake _0.7.3_ tmp:cache:clear') > redirect_to 'http://127.0.0.1:3000/admin' > end > > clear_cache > > Am pretty confused as to why in our controller the first two lines are > being skipped over and would greatly appreciate any help i recieve with > this issue. > > regards, > mike > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

