Forum: Radiant CMS How to use current_user in tags

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Vincent P. (Guest)
on 2008-10-21 17:44

I need to use the current_user in Radius tags. In fact it is working on
my computer which is running with MAC OS (and previously on my Windows
environment), but not on my friend computer which is on Windows.

Well, what I have done :
1. create an accessor attribut 'current_user' on page model
2. extended site_controller to give the current user to my current page
@page.current_user = current_user
3. Then, on my tags I'm using current_user like that :

And it is working on my computer. We have exactly the same project and
same database... has anyone any idea on what could broke the process? In
fact is nil on my computer's friend.

I will copy his and my gems list :

His :

ctionmailer (2.1.0)
   Service layer for easy email delivery and testing.

actionpack (2.1.0, 1.13.6)
   Web-flow and rendering framework putting the VC in MVC.

actionwebservice (1.2.6)
   Web service support for Action Pack.

activerecord (2.1.0, 1.15.6)
   Implements the ActiveRecord pattern for ORM.

activeresource (2.1.0)
   Think Active Record for web resources.

activesupport (2.1.0, 1.4.4)
   Support and utility classes used by the Rails framework.

cgi_multipart_eof_fix (2.5.0)
   Fix an exploitable bug in CGI multipart parsing.

ferret (0.11.5)
   Ruby indexing library.

fxri (0.3.6)
   Graphical interface to the RI documentation, with search engine.

fxruby (1.6.12)
   FXRuby is the Ruby binding to the FOX GUI toolkit.

gem_plugin (0.2.3)
   A plugin system based on rubygems that uses dependencies only

haml (2.0.1)
   An elegant, structured XHTML/XML templating engine. Comes with Sass,
   a similar CSS templating engine.

hpricot (0.6)
   a swift, liberal HTML parser with a fantastic library

htmlentities (4.0.0)
   A module for encoding and decoding (X)HTML entities.

json (1.1.1)
   A JSON implementation as a Ruby extension

log4r (1.0.5)
   Log4r is a comprehensive and flexible logging library for Ruby.

mime-types (1.15)
   Manages a MIME Content-Type that will return the Content-Type for a
   given filename.

mislav-will_paginate (2.3.5)
   Most awesome pagination solution for Rails

mongrel (1.1.2)
   A small fast HTTP library and server that runs Rails, Camping, Nitro
   and Iowa apps.

mysql (2.7.3)
   A win32-native build of the MySQL API module for Ruby.

radiant (0.6.9)
   A no-fluff content management system designed for small teams.

rails (2.1.0)
   Web-application framework with template engine, control-flow layer,
   and ORM.

rake (0.8.1, 0.7.3)
   Ruby based make-like utility.

RedCloth (3.301)
   a fast library for formatting Textile as HTML

rflickr (2006.02.01)
   Ruby interface to the Flickr API

rmagick (2.5.0)
   RMagick is an interface between the Ruby programming language and

ruby-debug-base (0.10.0)
   Fast Ruby debugger - core component

ruby-debug-ide (0.1.10)
   IDE interface for ruby-debug.

ruby-openid (2.1.2)
   A library for consuming and serving OpenID identities.

solr-ruby (0.0.6)
   Ruby library for working with Apache Solr

sources (0.0.1)
   This package provides download sources for remote gem installation

sqlite3-ruby (1.2.1)
   SQLite3/Ruby is a module to allow Ruby scripts to interface with a
   SQLite database.

win32-api (1.0.4)
   A superior replacement for Win32API

win32-clipboard (0.4.3)
   A package for interacting with the Windows clipboard

win32-dir (0.3.2)
   Extra constants and methods for the Dir class on Windows.

win32-eventlog (0.4.6)
   Interface for the MS Windows Event Log.

win32-file (0.5.4)
   Extra or redefined methods for the File class on Windows.

win32-file-stat (1.2.7)
   A File::Stat class tailored to MS Windows

win32-process (0.5.3)
   Adds fork, wait, wait2, waitpid, waitpid2 and a special kill method

win32-sapi (0.1.4)
   An interface to the MS SAPI (Sound API) library.

win32-sound (0.4.1)
   A library for playing with sound on MS Windows.

win32console (1.1.0)
   A library giving the Win32 console ANSI escape sequence support.

windows-api (0.2.0)
   An easier way to create methods using Win32API

windows-pr (0.7.2)
   Windows functions and constants bundled via Win32::API

Mine :
actionmailer (2.1.1, 1.3.6)
actionpack (2.1.1, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.1.1, 1.15.6)
activeresource (2.1.1)
activesupport (2.1.1, 1.4.4)
acts_as_ferret (0.4.1)
capistrano (2.0.0)
cgi_multipart_eof_fix (2.5.0, 2.2)
daemons (1.0.9, 1.0.7)
dnssd (0.6.0)
fastthread (1.0.1, 1.0)
fcgi (0.8.7)
ferret (0.11.4)
gem_plugin (0.2.3, 0.2.2)
highline (1.2.9)
hpricot (0.6)
libxml-ruby (
mislav-will_paginate (2.3.5)
mongrel (1.1.4, 1.0.1)
needle (1.3.0)
net-sftp (1.1.0)
net-ssh (1.1.2)
rails (2.1.1, 1.2.6)
rake (0.8.3, 0.7.3)
RedCloth (3.0.4)
ruby-openid (1.1.4)
ruby-yadis (0.3.4)
rubynode (0.1.3)
solr-ruby (0.0.6)
sources (0.0.1)
sqlite3-ruby (1.2.1)
termios (0.9.4)
will_paginate (2.2.2)

Thank you very much !
Sean C. (Guest)
on 2008-10-21 18:43
(Received via mailing list)
Vincent Pérès wrote:
> @page.current_user = current_user
> 3. Then, on my tags I'm using current_user like that :
> And it is working on my computer. We have exactly the same project and
> same database... has anyone any idea on what could broke the process? In
> fact is nil on my computer's friend.

Is your friend logged in to the admin site? Also, did you re-enable
sessions in the SiteController?

Vincent P. (Guest)
on 2008-10-21 19:16
Hello Sean,

I didn't enabled session, I created a new page type which is not using
In fact, the problem is on site_controller level, when I'm giving the
current user to my current page :
@page.current_user = current_user

On my computer 'current_user' exist, but the var is nil on the other
What could enabled or disabled current_user? (it's a helper if I
remember well)

Sean C. (Guest)
on 2008-10-21 19:33
(Received via mailing list)

The helper is there regardless.  However, current_user will only be
populated _if the user is logged in_.  To enable sessions, add this to
your extension, in the activate method:

SiteController.class_eval { session :disabled => false }

Vincent P. (Guest)
on 2008-10-22 11:59
Yes, he is logged in (sure).
To access to the current_user, I added a line on the
file_based_extension (butI'm not using this extension yet) :

module FileBasedLayout
  module SiteControllerExt
    def self.included(base)
      base.class_eval {
        include InstanceMethods
        alias_method_chain :process_page, :file_based_layout

    module InstanceMethods


      def process_page_with_file_based_layout(page)
        @page.current_user = current_user
        puts "****************** session : " + session.inspect
        if @page.layout && @page.layout.file_based?
          render :text => process_with_file_based_layout(@page), :layout
=> @page.layout.layout_file.gsub(/(\.[a-z]+)?\.[a-z]+$/, '')

current_user and session are not empty on my computer, but they are nil
on the other one... I'm realy lost because we have the same mysql dump
and project files.

If I can't resolve my problem, there is an other way to access to my
current user/user_id ?

Thank you !
This topic is locked and can not be replied to.