# Determining the Page Missing Behavior

**URL:** <https://www.ruby-forum.com/t/determining-the-page-missing-behavior/96339>\
**Category:** Radiant CMS\
**Created:** [June 28, 2006, 6:03am UTC](https://www.ruby-forum.com/t/determining-the-page-missing-behavior/96339 "2006-06-28T06:03:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dasch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@dasch](https://www.ruby-forum.com/u/dasch)\
**Post date:** [June 28, 2006, 6:03am UTC](https://www.ruby-forum.com/t/determining-the-page-missing-behavior/96339/1 "2006-06-28T06:03:33Z")

</div>

Currently Page Missing is a fairly hardcoded thing. If I wanted to  
create a new page missing behavior, I would have to do so by modifying  
the behavior of the parent to look for my new type of page missing  
behavior - This is because the page missing behavior is found based on  
behavior\_id.

I’d like to suggest that this actually be determined in another manner,  
possibly falling back to the behavior\_id. I like the idea of looking for  
a page with “404” as it’s slug, or some other string that seems  
appropriate. What say you?

As an example of what I’d like to do, I want to introduce a ‘best guess’  
page missing behavior that tries to find a matching page and if so  
redirects to that page, so that if there are the pages at the slugs:

/monkeys-are-good  
/monkeys-are-bad

then a request to /monkeys-are-g would get redirected to the first page,  
as would a request for /monkeys-are-good-arent-they or  
/monkeys-are-good.fdasa - a request to /monkeys-are would end up  
actually rendering the page missing page, as it couldn’t tell which is  
which (though the behavior might want to render the list of possibly  
matching urls). This is really useful when people email your links  
around and they end up getting slightly truncated due to line-wrapping  
or get extra punctuation from a bad cut/paste or a mail-agent that can’t  
tell tell that [Google](http://www.google.com/search). is not meant to have that  
trailing period.

Other parts of your site might have aliases - such as obseleted products  
where there’s a table mapping old products to new names and you want to  
take advantage of that table to send people to the right location.

Dan.

---

<div class="post-metadata">

**Author:** ![dasch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@dasch](https://www.ruby-forum.com/u/dasch)\
**Post date:** [June 28, 2006, 3:37pm UTC](https://www.ruby-forum.com/t/determining-the-page-missing-behavior/96339/2 "2006-06-28T15:37:43Z")

</div>

Daniel S. wrote:

> Currently Page Missing is a fairly hardcoded thing. If I wanted to  
> create a new page missing behavior, I would have to do so by modifying  
> the behavior of the parent to look for my new type of page missing  
> behavior - This is because the page missing behavior is found based on  
> behavior\_id.
> 
> I’d like to suggest that this actually be determined in another manner,  
> possibly falling back to the behavior\_id. I like the idea of looking for  
> a page with “404” as it’s slug, or some other string that seems  
> appropriate. What say you?

Yeah, it was done wrong to begin with. I’d accept a patch that added a  
#page\_missing? instance method to Behavior::Base that returned false and  
an overwridden method on PageMissingBehavior which returned true.

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