# Extending Admin PageController UI with class\_eval

**URL:** <https://www.ruby-forum.com/t/extending-admin-pagecontroller-ui-with-class-eval/116165>\
**Category:** Radiant CMS\
**Created:** [October 3, 2007, 3:33am UTC](https://www.ruby-forum.com/t/extending-admin-pagecontroller-ui-with-class-eval/116165 "2007-10-03T03:33:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Barrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@Alex\_Barrett](https://www.ruby-forum.com/u/Alex_Barrett)\
**Post date:** [October 3, 2007, 3:33am UTC](https://www.ruby-forum.com/t/extending-admin-pagecontroller-ui-with-class-eval/116165/1 "2007-10-03T03:33:08Z")

</div>

Hello all, I’m new to the list and to Radiant overall, so pardon me if  
this  
question is a little too basic.

I’m trying to write an extension to add a calendar capability for pages.  
It’s a pretty simple extension, adding just two fields to the page  
database,  
start\_date and end\_date. I’ve written the tag extensions and included a  
calendar helper class to render a calendar of events on pages.

My last hurdle is getting the start date and end date fields to display  
in  
the page admin ui. I’ve been able to get this to work on my development  
machine, which is running 0.6.1, but it doesn’t work on a remote server,  
where the live site will run. The remote site is running 0.6.2.

To accomplish this addition, I’m running the following code in the  
EventPageExtension::activate method:

Admin::PageController.class\_eval do  
before\_filter :add\_event\_page\_partials, :only =\> [:edit, :new]

```
def add_event_page_partials
    @meta ||= []
    @meta << {:field => "start_date", :type => "datetime_select", 

```

:args  
=\> [{:include\_blank =\> true, :order =\> [:month, :day, :year]}]}  
@meta \<\< {:field =\> “end\_date”, :type =\> “datetime\_select”,  
:args =\>  
[{:include\_blank =\> true, :order =\> [:month, :day, :year]}]}  
end  
end

Am I missing something? Is there some difference between 0.6.1 and  
0.6.2that is causing the problem or something more nefarious? Aside  
from  
upgrading my dev environment to 0.6.2, is there anything else I can try?

Thanks in advance,

~Alex
