Ok so I am looking at this api : http://www.ruby-doc.org/core-1.8.6/classes/File.html#M002608 and I am trying to use the move method here : File.open(movefrompath, "wb") File.move(movefrompath ,movetopath, true) NoMethodError (undefined method `move'' for File:Class): /app/controllers/messages_controller.rb:47:in `loadMessages'' c:/ruby/lib/ruby/1.8/find.rb:39:in `find'' c:/ruby/lib/ruby/1.8/find.rb:38:in `catch'' c:/ruby/lib/ruby/1.8/find.rb:38:in `find'' /app/controllers/messages_controller.rb:32:in `loadMessages'' /app/controllers/messages_controller.rb:23:in `loadFilesFromDir'' /app/controllers/messages_controller.rb:8:in `index'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `send'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action_without_filters'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_without_benchmark'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_without_caching'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `send'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process_without_filters'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/../lib/mongrel/rails.rb:76:in `process'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/../lib/mongrel/rails.rb:74:in `synchronize'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/../lib/mongrel/rails.rb:74:in `process'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:159:in `process_client'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:158:in `each'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:158:in `process_client'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in `initialize'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in `new'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:268:in `initialize'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:268:in `new'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:268:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/configurator.rb:282:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/configurator.rb:281:in `each'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/configurator.rb:281:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/mongrel_rails:128:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/command.rb:212:in `run'' c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/mongrel_rails:281 c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' ./script/server:3 -e:2:in `load'' -e:2 Rendering c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/templates/rescues/layout.erb (internal_server_error) -- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
the ''move'' method appears to be an instance method so do File.open(...) do |f| f.move(...) end On Jun 16, 4:52 pm, Ather Shiraz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ok so I am looking at this api : > > http://www.ruby-doc.org/core-1.8.6/classes/File.html#M002608 > > and I am trying to use the move method here : > > File.open(movefrompath, "wb") > File.move(movefrompath ,movetopath, true) > > NoMethodError (undefined method `move'' for File:Class): > /app/controllers/messages_controller.rb:47:in `loadMessages'' > c:/ruby/lib/ruby/1.8/find.rb:39:in `find'' > c:/ruby/lib/ruby/1.8/find.rb:38:in `catch'' > c:/ruby/lib/ruby/1.8/find.rb:38:in `find'' > /app/controllers/messages_controller.rb:32:in `loadMessages'' > /app/controllers/messages_controller.rb:23:in `loadFilesFromDir'' > /app/controllers/messages_controller.rb:8:in `index'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in > `send'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in > `perform_action_without_filters'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in > `call_filters'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in > `perform_action_without_benchmark'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > `perform_action_without_rescue'' > c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in > `perform_action_without_rescue'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in > `perform_action_without_caching'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in > `perform_action'' > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in > `cache'' > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in > `cache'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in > `perform_action'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in > `send'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in > `process_without_filters'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in > `process_without_session_management_support'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in > `process'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in > `process'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in > `handle_request'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in > `dispatch'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in > `dispatch_cgi'' > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in > `dispatch'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/../lib/mongrel/rails.rb:76:in > `process'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/../lib/mongrel/rails.rb:74:in > `synchronize'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/../lib/mongrel/rails.rb:74:in > `process'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:159:in > `process_client'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:158:in > `each'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:158:in > `process_client'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in > `run'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in > `initialize'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in > `new'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in > `run'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:268:in > `initialize'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:268:in > `new'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:268:in > `run'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/configurator.rb:282:in > `run'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/configurator.rb:281:in > `each'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/configurator.rb:281:in > `run'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/mongrel_rails:128:in > `run'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/command.rb:212:in > `run'' > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/mongrel_rails:281 > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in > `load'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in > `load'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in > `new_constants_in'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in > `load'' > c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64 > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require'' > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in > `require'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in > `new_constants_in'' > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in > `require'' > c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require'' > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require'' > ./script/server:3 > -e:2:in `load'' > -e:2 > > Rendering > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/templates/rescues/layout.erb > (internal_server_error) > -- > 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 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 -~----------~----~----~----~------~----~------~--~---
It is already inside a Find.file do |f| method, does it need to be inside another Fil.open()? I could not figure it out from the api or any extant examples of usage. Thanks I will try that if my response doesnt change anything. julian wrote:> the ''move'' method appears to be an instance method so do > > File.open(...) do |f| > f.move(...) > end > > On Jun 16, 4:52 pm, Ather Shiraz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
From ruby-doc -> "find(*paths) {|path| ...} Calls the associated block with the name of every file and directory listed as arguments, then recursively on their subdirectories, and so on." So, from that we can see that find yields the "name of every file" in the block. Therefore, it yields a String and not a File. Therefore, you do in fact still need to call File.open and then in another block do the move call. e.g. Find.find("/path") do |file_name| File.open(file_name) do |file_obj| file_obj.move(...) end end The api can be a little deceiving at first, but you''ll get used to it. Sometimes I might do the following to debug a situation like this: Find.find("/path"){|f| puts f.class} which will produce something like: String String String ... So you can see that the Find.find method is yielding strings and not actual file objects. On Jun 16, 7:53 pm, Ather Shiraz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> It is already inside a Find.file do |f| method, does it need to be > inside another Fil.open()? > > I could not figure it out from the api or any extant examples of usage. > > Thanks I will try that if my response doesnt change anything. > > julian wrote: > > the ''move'' method appears to be an instance method so do > > > File.open(...) do |f| > > f.move(...) > > end > > > On Jun 16, 4:52 pm, Ather Shiraz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > -- > 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 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 16, 11:38 pm, julian <thefool...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> the ''move'' method appears to be an instance method so do > > File.open(...) do |f| > f.move(...) > end >Or use FileUtils which does have a non-instance move method. Fred> On Jun 16, 4:52 pm, Ather Shiraz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > Ok so I am looking at this api : > > >http://www.ruby-doc.org/core-1.8.6/classes/File.html#M002608 > > > and I am trying to use the move method here : > > > File.open(movefrompath, "wb") > > File.move(movefrompath ,movetopath, true) > > > NoMethodError (undefined method `move'' for File:Class): > > /app/controllers/messages_controller.rb:47:in `loadMessages'' > > c:/ruby/lib/ruby/1.8/find.rb:39:in `find'' > > c:/ruby/lib/ruby/1.8/find.rb:38:in `catch'' > > c:/ruby/lib/ruby/1.8/find.rb:38:in `find'' > > /app/controllers/messages_controller.rb:32:in `loadMessages'' > > /app/controllers/messages_controller.rb:23:in `loadFilesFromDir'' > > /app/controllers/messages_controller.rb:8:in `index'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base. rb:1158:in > > `send'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base. rb:1158:in > > `perform_action_without_filters'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filte rs.rb:697:in > > `call_filters'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filte rs.rb:689:in > > `perform_action_without_benchmark'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/bench marking.rb:68:in > > `perform_action_without_rescue'' > > c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/bench marking.rb:68:in > > `perform_action_without_rescue'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescu e.rb:199:in > > `perform_action_without_caching'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cachi ng.rb:678:in > > `perform_action'' > > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connect ion_adapters/abstract/query_cache.rb:33:in > > `cache'' > > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_c ache.rb:8:in > > `cache'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cachi ng.rb:677:in > > `perform_action'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base. rb:524:in > > `send'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base. rb:524:in > > `process_without_filters'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filte rs.rb:685:in > > `process_without_session_management_support'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/sessi on_management.rb:123:in > > `process'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base. rb:388:in > > `process'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispa tcher.rb:171:in > > `handle_request'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispa tcher.rb:115:in > > `dispatch'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispa tcher.rb:126:in > > `dispatch_cgi'' > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispa tcher.rb:9:in > > `dispatch'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/../lib/mong rel/rails.rb:76:in > > `process'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/../lib/mong rel/rails.rb:74:in > > `synchronize'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/../lib/mong rel/rails.rb:74:in > > `process'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb: 159:in > > `process_client'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb: 158:in > > `each'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb: 158:in > > `process_client'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb: 285:in > > `run'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb: 285:in > > `initialize'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb: 285:in > > `new'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb: 285:in > > `run'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb: 268:in > > `initialize'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb: 268:in > > `new'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb: 268:in > > `run'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/con figurator.rb:282:in > > `run'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/con figurator.rb:281:in > > `each'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/con figurator.rb:281:in > > `run'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/mongrel_rai ls:128:in > > `run'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/com mand.rb:212:in > > `run'' > > c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/mongrel_rai ls:281 > > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/depen dencies.rb:489:in > > `load'' > > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/depen dencies.rb:489:in > > `load'' > > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/depen dencies.rb:342:in > > `new_constants_in'' > > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/depen dencies.rb:489:in > > `load'' > > c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb: 64 > > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > > `gem_original_require'' > > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > > `require'' > > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/depen dencies.rb:496:in > > `require'' > > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/depen dencies.rb:342:in > > `new_constants_in'' > > c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/depen dencies.rb:496:in > > `require'' > > c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 > > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > > `gem_original_require'' > > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > > `require'' > > ./script/server:3 > > -e:2:in `load'' > > -e:2 > > > Rendering > > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/templ ates/rescues/layout.erb > > (internal_server_error) > > -- > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Do you have a link to this ruby doc please? Now I can''t seem to get File.exist to work. I am using it because it keeps giving an error that a certain directory exists ; there is no way of checking for existence of a directory I tried File.exist and (file.directory) but that is giving the same error : "method does not exist". julian wrote:> From ruby-doc -> > "find(*paths) {|path| ...} > Calls the associated block with the name of every file and directory > listed as arguments, then recursively on their subdirectories, and so > on." > So, from that we can see that find yields the "name of every file" in > the block. Therefore, it yields a String and not a File. Therefore, > you do in fact still need to call File.open and then in another block > do the move call. e.g. > Find.find("/path") do |file_name| > File.open(file_name) do |file_obj| > file_obj.move(...) > end > end-- Posted via http://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 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 17 Jun 2008, at 16:49, Ather Shiraz wrote:> > Do you have a link to this ruby doc please? Now I can''t seem to get > File.exist to work. I am using it because it keeps giving an error > that > a certain directory exists ; there is no way of checking for existence > of a directory I tried File.exist and (file.directory) but that is > giving the same error : "method does not exist".http://www.ruby-doc.org/ :-) The method is File.exist? not File.exist Fred> > > julian wrote: >> From ruby-doc -> >> "find(*paths) {|path| ...} >> Calls the associated block with the name of every file and directory >> listed as arguments, then recursively on their subdirectories, and so >> on." >> So, from that we can see that find yields the "name of every file" in >> the block. Therefore, it yields a String and not a File. Therefore, >> you do in fact still need to call File.open and then in another block >> do the move call. e.g. >> Find.find("/path") do |file_name| >> File.open(file_name) do |file_obj| >> file_obj.move(...) >> end >> end > -- > Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On Jun 16, 11:38�pm, julian <thefool...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> the ''move'' method appears to be an instance method so do >> >> File.open(...) do |f| >> � f.move(...) >> end >> > > Or use FileUtils which does have a non-instance move method. > > FredI tried fileutils.mv and it gave me an error saying permission denied... I could post the detailed error if you wish. -- Posted via http://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Did you have the file open at the time you called mv? I think you''d get that error if you did... -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Ather Shiraz Sent: Tuesday, June 17, 2008 9:12 AM To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails] Re: Why is File.Move method Not Found? Frederick Cheung wrote:> On Jun 16, 11:38 pm, julian <thefool...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> the ''move'' method appears to be an instance method so do >> >> File.open(...) do |f| >> f.move(...) >> end >> > > Or use FileUtils which does have a non-instance move method. > > FredI tried fileutils.mv and it gave me an error saying permission denied... I could post the detailed error if you wish. -- Posted via http://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
can you move the file without using ruby? On Jun 17, 12:20 pm, "Pardee, Roy" <parde...-go57ItdSaco@public.gmane.org> wrote:> Did you have the file open at the time you called mv? I think you''d get > that error if you did... > > -----Original Message----- > From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Ather Shiraz > Sent: Tuesday, June 17, 2008 9:12 AM > To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Subject: [Rails] Re: Why is File.Move method Not Found? > > Frederick Cheung wrote: > > On Jun 16, 11:38 pm, julian <thefool...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> the ''move'' method appears to be an instance method so do > > >> File.open(...) do |f| > >> f.move(...) > >> end > > > Or use FileUtils which does have a non-instance move method. > > > Fred > > I tried fileutils.mv and it gave me an error saying permission denied... > > I could post the detailed error if you wish. > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
julian wrote:> can you move the file without using ruby?I can move the file without using ruby (from windows explorer) how not using ruby. I tried changing permissions on the file and the directory to which I am moving this file to but it keeps giving the error : Permission denied C:/James/james-binary.../var/mail/inboxes/admin/archive Errno:EACCESS... Currently reading the old posts on the error. -- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
Ok no worries I just got it to work I was attempting to file."open" a directory that is why I was getting this error. It was successfully able to move the file which is very cool. Thanks for all your help and sorry for the false alarm. -- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---