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 T. 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
load_missing_constant' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:452:inconst_missing’
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.