Forum: Ruby on Rails How to pass controller instances class to UserNotifier

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John5511 J. (Guest)
on 2008-10-19 13:48
Hi,

I am using "UserNotifier < ActionMailer::Base" in model.

In my User Model class I have these
  after_create {|user| UserNotifier.deliver_signup_notification(user) }
  after_save   {|user| UserNotifier.deliver_activation(user) if
user.recently_activated? }

In my view "signup_invitation.rhtml", I have these,
-------------------------------
<%= @user.login %> has just invited you to join <%= @current_domain.name
%>
---------------------------------------------

Do you guys know how to pass "@current_domain" instant class to view?
I already define @current_domain instance in Application.rb. It does
have value when create user in controller but after UserNotifier call,
the value of @current_domain is nil in "view".

==============================================
Or may be is not a good idea to put
"UserNotifier.deliver_signup_notification(user)" in model and put it in
controller instead.

thank you in advanced,
John
This topic is locked and can not be replied to.