# Instance method scope

**URL:** <https://www.ruby-forum.com/t/instance-method-scope/127106>\
**Category:** Rails\
**Created:** [January 25, 2008, 12:31am UTC](https://www.ruby-forum.com/t/instance-method-scope/127106 "2008-01-25T00:31:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [January 25, 2008, 12:31am UTC](https://www.ruby-forum.com/t/instance-method-scope/127106/1 "2008-01-25T00:31:31Z")

</div>

Hello, I am confused about the scope of the instance method  
“authenticated?” in the class shown below (it’s defined in the  
application controller). It does not seem to be available in the block  
initialising my active scaffold but it is available inside the method  
“foo”.

How can I gain access to the method in the initialisation block?

Many thanks!

class ItemController \< ApplicationController  
active\_scaffold :item do |config|

```
columns[:category].ui_type = :select

if authenticated?
  p "authenticated"
  config.label = "Manage Items"
else
  p "not authenticated"
  config.label = "Search"
  config.list.columns = [:description, :address_posttown]
  columns[:address_posttown].label = "Town"
end

```

end

before\_filter :foo  
def foo  
if authenticated?  
p “authenticated”  
else  
p “not authenticated”  
end  
end

end

---

<div class="post-metadata">

**Author:** ![johnlester](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@johnlester](https://www.ruby-forum.com/u/johnlester)\
**Post date:** [January 25, 2008, 2:55pm UTC](https://www.ruby-forum.com/t/instance-method-scope/127106/2 "2008-01-25T14:55:00Z")

</div>

I misunderstood the initialisation order of classes vs instances but I  
understand that now 🙂
