# ActionController \<-\> ActiveView code access ambiguity

**URL:** <https://www.ruby-forum.com/t/actioncontroller-activeview-code-access-ambiguity/131985>\
**Category:** Rails\
**Created:** [March 14, 2008, 9:28pm UTC](https://www.ruby-forum.com/t/actioncontroller-activeview-code-access-ambiguity/131985 "2008-03-14T21:28:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sinm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@sinm](https://www.ruby-forum.com/u/sinm)\
**Post date:** [March 14, 2008, 9:28pm UTC](https://www.ruby-forum.com/t/actioncontroller-activeview-code-access-ambiguity/131985/1 "2008-03-14T21:28:02Z")

</div>

Hi All!  
This is not a problem in general but i’ve just missed the point.  
If my application has a global state, which i have to use both  
throughout ActionController and ActiveView, then, where to place that  
state?  
E.g. if I do this:

class ApplicationController \< ActionController::Base  
protected  
def authenticated?  
!user.nil?  
end  
end

then I can’t use that from any View. And, on the other hand, if I do  
write that as a public method - it acts as an action…

So, where to place such “global” properties?

Thanx a lot!

---

<div class="post-metadata">

**Author:** ![sinm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@sinm](https://www.ruby-forum.com/u/sinm)\
**Post date:** [March 14, 2008, 10:57pm UTC](https://www.ruby-forum.com/t/actioncontroller-activeview-code-access-ambiguity/131985/2 "2008-03-14T22:57:03Z")

</div>

Anyone?

---

<div class="post-metadata">

**Author:** ![sinm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@sinm](https://www.ruby-forum.com/u/sinm)\
**Post date:** [March 14, 2008, 11:13pm UTC](https://www.ruby-forum.com/t/actioncontroller-activeview-code-access-ambiguity/131985/3 "2008-03-14T23:13:29Z")

</div>

On Fri, Mar 14, 2008 at 1:27 PM, sinm [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> def authenticated?  
> !user.nil?  
> end  
> end
> 
> then I can’t use that from any View. And, on the other hand, if I do  
> write that as a public method - it acts as an action…
> 
> So, where to place such “global” properties?
> 
> Thanx a lot!

[http://rails.rubyonrails.org/classes/ActionController/Helpers/ClassMethods.html#M000284](http://rails.rubyonrails.org/classes/ActionController/Helpers/ClassMethods.html#M000284)

class FooController  
helper\_method :authenticated?  
end

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![sinm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@sinm](https://www.ruby-forum.com/u/sinm)\
**Post date:** [March 14, 2008, 11:38pm UTC](https://www.ruby-forum.com/t/actioncontroller-activeview-code-access-ambiguity/131985/4 "2008-03-14T23:38:46Z")

</div>

Oh. Thanks. I’ll give it a try.
