# Radiant Issue Served by Litespeed 3.1

**URL:** <https://www.ruby-forum.com/t/radiant-issue-served-by-litespeed-3-1/90948>\
**Category:** Radiant CMS\
**Created:** [April 3, 2007, 8:31am UTC](https://www.ruby-forum.com/t/radiant-issue-served-by-litespeed-3-1/90948 "2007-04-03T08:31:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![benni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c67d28/32.png) [@benni](https://www.ruby-forum.com/u/benni)\
**Post date:** [April 3, 2007, 8:31am UTC](https://www.ruby-forum.com/t/radiant-issue-served-by-litespeed-3-1/90948/1 "2007-04-03T08:31:26Z")

</div>

Hi,

I have the Radiant CMS running from a Litespeed 3.1 Webserver and the  
current url is [http://my.slice.ip.address/admin/welcome](http://my.slice.ip.address/admin/welcome) which is good.

Unfortunately there is no Admin Login screen, only this =\>  
Application error (Apache)

Change this error message for exceptions thrown outside of an action  
(like  
in Dispatcher setups or broken Ruby code) in public/500.html  
So it seems that Radiant is being served correctly into the $VH\_ROOT of  
the  
webserver (/srv/www/radiant/) but it is not seeing the appropriate view.

Is this a correct assumption?

Cheers, Ben.

---

<div class="post-metadata">

**Author:** ![benni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c67d28/32.png) [@benni](https://www.ruby-forum.com/u/benni)\
**Post date:** [April 3, 2007, 5:49pm UTC](https://www.ruby-forum.com/t/radiant-issue-served-by-litespeed-3-1/90948/2 "2007-04-03T17:49:36Z")

</div>

Benjamin M. wrote:

> Unfortunately there is no Admin Login screen, only this =\>  
> Application error (Apache)

Whenever you see an Application Error on a Rails app it’s an indication  
that you should check the logs to see if you can find the actual error  
that is being thrown. That will generally tell you a lot about what the  
problem is.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![benni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c67d28/32.png) [@benni](https://www.ruby-forum.com/u/benni)\
**Post date:** [April 4, 2007, 1:59am UTC](https://www.ruby-forum.com/t/radiant-issue-served-by-litespeed-3-1/90948/3 "2007-04-04T01:59:28Z")

</div>

Hey all,  
I’m helping Andrea F. work on his fantastic Gallery Extension:  
[http://darcs.bigchieflabs.com/radiant/extensions/gallery/](http://darcs.bigchieflabs.com/radiant/extensions/gallery/)  
(download with ‘darcs’ - [http://darcs.net](http://darcs.net))

Anyway I’m trying to add some globally available tags to it:

There is a Model declared thus:  
class Gallery \< ActiveRecord::Base  
has\_many :items,  
:class\_name =\> ‘GalleryItem’  
  
end

And I have made a module in the extension /lib called gallery\_tags.rb  
which contains this (fake example)…

module GalleryTags  
#tags available globally, not just on GalleryPages  
include Radiant::Taggable

tag “mytag” do |tag|  
if tag.attr[“id”]  
tag.locals.gallery = Gallery.find\_by\_id tag.attr[“id”]  
tag.expand  
end

tag “anothertag” do |tag|  
tag.locals.gallery.name  
end

 end

added to the extension with:  
def activate  
admin.tabs.add “Galleries”, “/admin/gallery”, :after =\>  
“Layouts”, :visibility =\> [:all]  
Page.send :include, GalleryTags  
end

yet when I do this in a page:

\<r:mytag id=‘1’\>  
\<r:anothertag\>  
\</r:mytag\>

I get this:  
You have a nil object when you didn’t expect it! The error occurred  
while evaluating nil.name

It seems that tag.locals.gallery is being set to nil in between the  
tag calls… I can’t work out why because other extensions seem to do  
similar things… it’s very confusing.

Any help much appreciated.

Thanks,  
-Adam

---

<div class="post-metadata">

**Author:** ![benni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c67d28/32.png) [@benni](https://www.ruby-forum.com/u/benni)\
**Post date:** [April 4, 2007, 9:12am UTC](https://www.ruby-forum.com/t/radiant-issue-served-by-litespeed-3-1/90948/4 "2007-04-04T09:12:53Z")

</div>

You need to call the id in both tags. I know it is a little  
counterintuitive, but the id tag is not being passed to the first  
tag, just the second. I banged my head on this for a few days, try it  
like this:

tag “mytag” do |tag|  
if tag.attr[“id”]  
tag.locals.gallery = Gallery.find\_by\_id tag.attr[“id”]  
tag.expand  
end

tag “anothertag” do |tag|  
gallery = Gallery.find\_by\_id tag.attr[“id”] || tag.locals.gallery  
gallery.name  
end

This should work, but I haven’t tested it, so I make no promises.  
You may want to add a some sort of error handling in there in case  
no id is found.

Keith B.  
removed\_email\_address@domain.invalid  
Tel: +49-7731-7983830

---

<div class="post-metadata">

**Author:** ![benni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c67d28/32.png) [@benni](https://www.ruby-forum.com/u/benni)\
**Post date:** [April 4, 2007, 1:06pm UTC](https://www.ruby-forum.com/t/radiant-issue-served-by-litespeed-3-1/90948/5 "2007-04-04T13:06:16Z")

</div>

I think I’ve worked it out…

Basically tag.locals is a “virtual” (don’t know correct name) method…  
so if you want tag.locals.item.name you should first assign  
tag.locals.item to a variable and then query that variable:  
i.e.  
item = tag.locals.item  
return item.name

you can assign with tag.locals.item =, but not tag.locals.item.name =  
for example.

brackets might work like:  
(tag.locals.item).name

haven’t tested that.

Cheers,  
-Adam

---

<div class="post-metadata">

**Author:** ![benni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c67d28/32.png) [@benni](https://www.ruby-forum.com/u/benni)\
**Post date:** [April 4, 2007, 11:37am UTC](https://www.ruby-forum.com/t/radiant-issue-served-by-litespeed-3-1/90948/6 "2007-04-04T11:37:10Z")

</div>

Keith,

This didn’t work.

I’m going to work around it by doing:  
\<r:anothertag id=‘1’ /\>  
\<r:yetanothertag id=‘1’ /\>

for the moment… but it’s not going to work in the long run… is  
there a way to force/pass or create your own variables?

e.g  
tag “mytag” do |tag|  
if tag.attr[“id”]  
tag.locals.gallery = Gallery.find\_by\_id tag.attr[“id”]  
tag.expand { “id” =\> “1”}  
end

…or…

tag “mytag” do |tag|  
if tag.attr[“id”]  
tag.locals.my\_gallery = Gallery.find\_by\_id tag.attr[“id”]  
tag.expand  
end

…or…

tag “mytag” do |tag|  
if tag.attr[“id”]  
tag.globals.gallery = Gallery.find\_by\_id tag.attr[“id”]  
tag.expand  
end

Thanks in advance,  
-Adam
