I have an application with a need to email a URL to users, right after the user''s record is created. The application currently uses an observer to determine when a new record is saved. Problem is, the observer needs to generate a URL for a resource within the application. The controller provides this functionality through the url_for method. Is there some way to access the current controller from inside an observer? Or is there a better method for handling this that keeps the controller more separated from the observer? -- "Thanks to the crew of rocketscientists.ca for the gmail invitation!" rocketscientists.ca _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org lists.rubyonrails.org/mailman/listinfo/rails
Dennis Sutch wrote:> I have an application with a need to email a URL to users, right after > the user''s record is created. The application currently uses an > observer to determine when a new record is saved. > > Problem is, the observer needs to generate a URL for a resource within > the application. The controller provides this functionality through the > url_for method. > > Is there some way to access the current controller from inside an > observer? Or is there a better method for handling this that keeps the > controller more separated from the observer?I second this need. Mailers need simple access to the Routing machinery. Something like Route.new(:controller => ''signup'', :action => ''confirm'').url would be great. jeremy