Instance method scope

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs