stevepoll
2007-May-11 17:06 UTC
Anybody working through "Beginning Ruby on Rails E-Commerce"?
Hi. I''m an experienced Java developer making the jump to Rails, so please forgive the newbieness of this post. I picked up two books initially: the "Agile" book by Dave Thomas and the "E-Commerce" book by Hellsten and Laine. I''m trying to work my way through the "Emporium" sample application in the latter book, and it''s been a bit of a frustrating exercise. There''s an errata page on the publisher''s website that helps to mitigate some of the issues I''ve had with mistakes in the book, but right now I''m faced with an issue that I''m not able to resolve and there is no mention of it in the errata. At issue is the following code... class UserNotifier < ActionMailer::Base @@session = ActionController::Integration::Session.new ..... @body[:url] = @@session.url_for(.....) The code describes the code above as "trickery" (page 240), since the url_for method is normally not available inside mailers, as it is an instance method for ActionController controllers. Ok, so far so good. The problem is that when I try to test the app, I get the following error, along with a small stack trace: uninitialized constant ActionController::Integration C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:263:in `load_missing_constant'' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:452:in `const_missing'' #{RAILS_ROOT}/app/models/user_notifier.rb:2 #{RAILS_ROOT}/app/models/user_observer.rb:3:in `after_save'' #{RAILS_ROOT}/app/controllers/account_controller.rb:49:in `forgot_password'' One thing that I thought was that the authors were coding to Rails 1.1, while I have 1.2 on my system. As a result of this I have seen several deprecation warnings throughout the course of my studying the example app. Is this simply a case of something that was allowed in 1.1 but is a no-no now? Or is there something else that I am missing. Any help would be appreciated. Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Stan
2007-May-11 19:21 UTC
Re: Anybody working through "Beginning Ruby on Rails E-Commerce"?
> One thing that I thought was that the authors were coding to Rails > 1.1, while I have 1.2 on my system. As a result of this I have seen > several deprecation warnings throughout the course of my studying the > example app. Is this simply a case of something that was allowed in > 1.1 but is a no-no now? Or is there something else that I am missing.If you add this: require ''action_controller/integration'' to the top of /app/model/s/user_notifier.rb and restart your server, this error should go away. I''m not clear what changed from 1.1.x to 1.2.x that makes this a problem, but empirically this is what fixes things. Overall, I think this is a great book...wish they''d update it for RoR 1.2.x... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---