I generated an extension and created a simple page called  
"simple_page.rb" :

class SimplePage < Page
   def virtual?
     true
   end

   def cache?
     false
   end

   def render
     lazy_initialize_parser_and_context
     if layout
       parse_object(layout)
     else
       render_page_part(:body)
     end
   end
end

And in the <extension name>_extension.rb file I added SimplePage to  
the activate method:

def activate
     # admin.tabs.add "Mc Coy", "/admin/mc_coy", :after =>  
"Layouts", :visibility => [:all]
     SimplePage
   end

When I set they page type on a page to "Simple" and try to access the  
page, I get a 404.

Examining the log and injecting logger statements it seems that the  
find_by_url method on the page is unable to locate the slug of the  
virtual page:
SELECT * FROM pages WHERE (pages.parent_id = 1) AND (pages."slug" =  
'simple') LIMIT 1
Returns a row when executed from a postgresql console session  but  
fails to return a row when executing inside of Radiant.

I can also make the page a env dump page, for example, and don't get  
a 404 error.  When I turn the page back into a "Simple" page, I go  
back to 404-ville.

Any thoughts?  Am I not understanding how the virtual page dealy  
works?  Any input would be much appreciated.

_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to