Accessing application helper from a tag

I’ve been subscribed to this mailing list for many months now but
this is my first time posting. Please forgive me if I do something
wrong :slight_smile:

I am trying to use tags to show content based on user session &
permissions. For example, a custom sidebar for when someone is not
logged in, for when they are logged in as an administrator, etc.

In the radiant admin this is performed by erb in /vendor/radiant/app/
views/layouts/application.rhtml. I could create a layout like this,
but then I don’t have pages that are editable through radiant.

I believe the problem is that the tag I have written does not see the
radiant application helper. Is there any way to get around this? My
code is below with the error.

from vendor/extensions/session_tags/app/models/session_tags.rb:

module SessionTags
include Radiant::Taggable

desc %{ Check for admin session. }
tag ‘session’ do |tag|
if admin?


from vendor/radiant/app/helpers/application_helper.rb:

def admin?
user = session[‘user’]
user and user.admin?

in the page part:

Put your radius tags here


undefined method `admin?’ for #

Can you do a view source and see what the actual object type is that
is indicated by the # in the error. Since objects are returned as
#ObjectName:124342 they get partially mistaken for HTML tags by
browsers rendering the page.