Hi,there I''ve recently used hpricot to parse xml result. The code is as shown in http://apassant.net/blog/post/2006/08/29/108-geolocation-with-ruby-on-rails-and-google-maps while I seem to be able to get it to work in irb, it didn''t work in my application. The difference seems to be in require ''open-uri'' require ''rubygems'' require ''hpricot'' while in irb, they all return true. in the function that''s being called,I setup a breakpoint and can see that these three values are false. anybody has ideas what happened? Greatly appreciated for any help! -- 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 -~----------~----~----~----~------~----~------~--~---
Is your rails app definitely hitting the same ruby binary that running irb or your command-line ruby script? Almost sounds like either you''re hitting a second (or older) install that doesn''t have some of the libs you''re trying to require, or else ruby''s load paths are getting jacked up somewhere along the way if the requires are in fact failing in your rails app. Also, you may want to check out the google_geocode library: http://dev.robotcoop.com/Libraries/google-geocode/ I''ve used it in essentially the same exact way you''ve described in your blog post, as a before_save in my model, works wonderfully. Looks like your method would work just as well, just thought I''d point out an alternate solution. On Nov 21, 2006, at 11:35 PM, jacquie wrote:> > Hi,there > > I''ve recently used hpricot to parse xml result. The code is as > shown in > http://apassant.net/blog/post/2006/08/29/108-geolocation-with-ruby- > on-rails-and-google-maps > > while I seem to be able to get it to work in irb, it didn''t work in my > application. > > The difference seems to be in > require ''open-uri'' > require ''rubygems'' > require ''hpricot'' > > while in irb, they all return true. in the function that''s being > called,I setup a breakpoint and can see that these three values are > false. > > anybody has ideas what happened? > > Greatly appreciated for any help! > > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Thanks for your reply JD. You might be right since I''ve installed a few ruby versions and need to clean up. I setup the ruby path to C:/ruby/bin; so I thought both of the applications and irb should go for this path? how do I check if they use the same ruby binary? Thanks! JD Harrington wrote:> Is your rails app definitely hitting the same ruby binary that > running irb or your command-line ruby script? Almost sounds like > either you''re hitting a second (or older) install that doesn''t have > some of the libs you''re trying to require, or else ruby''s load paths > are getting jacked up somewhere along the way if the requires are in > fact failing in your rails app. > > Also, you may want to check out the google_geocode library: > > http://dev.robotcoop.com/Libraries/google-geocode/ > > I''ve used it in essentially the same exact way you''ve described in > your blog post, as a before_save in my model, works wonderfully. > Looks like your method would work just as well, just thought I''d > point out an alternate solution.-- 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 11/21/06, jacquie <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi,there > > I''ve recently used hpricot to parse xml result. The code is as shown in > http://apassant.net/blog/post/2006/08/29/108-geolocation-with-ruby-on-rails-and-google-maps > > while I seem to be able to get it to work in irb, it didn''t work in my > application. > > The difference seems to be in > require ''open-uri'' > require ''rubygems'' > require ''hpricot'' > > while in irb, they all return true. in the function that''s being > called,I setup a breakpoint and can see that these three values are > false. > > anybody has ideas what happened? > > Greatly appreciated for any help!If require returns false it only means the library is already loaded - it doesn''t mean there is an error. If there is an error require raises an exception. So in your app you already have those libraries loaded when you require - so its nothing to worry about . - rob -- http://www.robsanheim.com http://www.seekingalpha.com http://www.ajaxian.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 -~----------~----~----~----~------~----~------~--~---