I have the following setup:

Home Page
  |
  -- People (PeoplePage)
       |
       -- Person (PersonPage)
            |
            -- Bio (BioPage)
            -- Contact (ContactInfoPage)

I made an extension with some Page Types (in parentheses) wich are used to
display the list of people in the company and the data about a particular
person, respectively (the latter being a virtual page).

Since a person object carries plenty of data I need to split the data into
several pages, like:

/people/18                       # 18 is an ID of a existing object (Person)
/people/18/bio
/people/18/contact
...

It seems I have a problem with find_by_url in PersonPage:

  def virtual?
    true
  end

  def find_by_url(url, live = true, clean = true)
    url = clean_url(url) if clean
    if url =~ %r{#{parent.url}/\d+/bio/?$}
      children.find_by_class_name 'BioPage'
    else
      super
    end
  end

This looks fine to my untrained eye, but:

$ script/console
Loading development environment.
>> p = Page.find_by_url('/people/18/bio/')
=> #<FileNotFoundPage:0xb709db54 @attributes={"virtual"=>"1",
"class_name"=>"FileNotFoundPage", "slug"=>"file-not-found",
"updated_at"=>"2008-01-24 00:47:14", "title"=>"File Not Found",
"created_by"=>"1", "breadcrumb"=>"File Not Found", "lock_version"=>"2",
"updated_by"=>"1", "id"=>"3", "published_at"=>"2008-01-20 23:51:27",
"status_id"=>"100", "layout_id"=>nil, "parent_id"=>"2",
"created_at"=>"2008-01-20 22:51:27"}>

Then, this works in the same console:

  p = Page.find_by_url('/people/18/')
  p.children.find_by_class_name 'BioPage'

Regexp looks fine too, as far as I can tell. I know this is a cockpit
problem, but I need someone to point a finger at it, since I must be (code)
blind or something. BioPage is declared virtual, too (if it matters). Can
anyone suggest what could be wrong?
_______________________________________________
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