# Controller information in models?

**URL:** <https://www.ruby-forum.com/t/controller-information-in-models/104328>\
**Category:** Rails\
**Created:** [May 16, 2007, 8:14pm UTC](https://www.ruby-forum.com/t/controller-information-in-models/104328 "2007-05-16T20:14:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [May 16, 2007, 8:14pm UTC](https://www.ruby-forum.com/t/controller-information-in-models/104328/1 "2007-05-16T20:14:15Z")

</div>

I have a situation where I need information from my controller in my  
models.

For example, I want to send out an email to a user notifying them that  
their user information was modified. I only want to do this if this is  
done in the admin section. In my controller I set a variable called  
@admin = true.

How can I get the value of that @admin variable without having to pass  
in the controller object every time I create a new ActiveRecord object?

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [May 16, 2007, 9:17pm UTC](https://www.ruby-forum.com/t/controller-information-in-models/104328/2 "2007-05-16T21:17:11Z")

</div>

I would favor adding some sort of ‘update\_with\_notification’ method  
instead of trying to get information from the controller. This would  
be much easier and would be better for the structure of your  
application.

Steve

* * *

[www.stephenbartholomew.co.uk](http://www.stephenbartholomew.co.uk)  
[www.curve21.com](http://www.curve21.com)
