# Page Rendering Problem

**URL:** <https://www.ruby-forum.com/t/page-rendering-problem/110597>\
**Category:** Radiant CMS\
**Created:** [July 27, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/page-rendering-problem/110597 "2007-07-27T22:50:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Thompson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b2d939/32.png) [@James\_Thompson](https://www.ruby-forum.com/u/James_Thompson)\
**Post date:** [July 27, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/page-rendering-problem/110597/1 "2007-07-27T22:50:55Z")

</div>

I have the following bit of code defining a custom page type. I  
define an event and the normal body part. However, when a URL comes  
it is getting parsed correctly but the page is rendering with the  
body part rather than the event part. Can anyone see something that I  
am just missing?

=== SNIP ===  
class EventPage \< Page  
description ‘Provides behaviors to a support the events system.’

## 

# Behaviors

## 

@event, @render = nil

def cache?  
false  
end

def find\_by\_url(url, live = true, clean = false)  
url = clean\_url(url) if clean

```
 if url =~ %r{/([0-9]*)/?$}
   event = $1

   if !event.blank?
     @event = Event.find(event)

     @render = 'event'

     self
   else
     super
   end
 else
   super
 end

```

end

def render  
if @render.nil?  
super  
else

```
   lazy_initialize_parser_and_context

   if layout
     parse_object(layout)
   else
     render_part(@render)
   end
 end

```

end  
end  
=== SNIP ===

Thanks,  
James Thompson
