# How to pass controller instances class to UserNotifier

**URL:** <https://www.ruby-forum.com/t/how-to-pass-controller-instances-class-to-usernotifier/151273>\
**Category:** Rails\
**Created:** [October 19, 2008, 11:48am UTC](https://www.ruby-forum.com/t/how-to-pass-controller-instances-class-to-usernotifier/151273 "2008-10-19T11:48:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![john5511](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ac8455/32.png) [@john5511](https://www.ruby-forum.com/u/john5511)\
**Post date:** [October 19, 2008, 11:48am UTC](https://www.ruby-forum.com/t/how-to-pass-controller-instances-class-to-usernotifier/151273/1 "2008-10-19T11:48:55Z")

</div>

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
