# Trouble with inheritance in ArchivePage

**URL:** <https://www.ruby-forum.com/t/trouble-with-inheritance-in-archivepage/113156>\
**Category:** Radiant CMS\
**Created:** [August 28, 2007, 7:38am UTC](https://www.ruby-forum.com/t/trouble-with-inheritance-in-archivepage/113156 "2007-08-28T07:38:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sylvestre\_MergulhSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f17d59/32.png) [@Sylvestre\_MergulhSS](https://www.ruby-forum.com/u/Sylvestre_MergulhSS)\
**Post date:** [August 28, 2007, 7:38am UTC](https://www.ruby-forum.com/t/trouble-with-inheritance-in-archivepage/113156/1 "2007-08-28T07:38:05Z")

</div>

I’m developing an extension with radiant 0.6.2 as a gem. In the  
extension I generated a page thats inherits from ArchivePage, like  
this:

class CategoryPage \< ArchivePage  
end

And put it in activate like this:

def activate  
CategoryPage  
end

Now when I try to load radiant (admin or not), I’ve got in the  
terminal of webrick:

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/  
luke@darkstar:~/devel/covisa$ script/server  
=\> Booting WEBrick…  
=\> Rails application started on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
=\> Ctrl-C to shutdown server; call with --help for options  
[2007-08-28 02:25:35] INFO WEBrick 1.3.1  
[2007-08-28 02:25:35] INFO ruby 1.8.5 (2006-08-25) [i486-linux]  
[2007-08-28 02:25:35] INFO WEBrick::HTTPServer#start: pid=8414  
port=3000  
127.0.0.1 - - [28/Ago/2007:02:25:42 BRT] “GET / HTTP/1.1” 200 0

- → /  
[2007-08-28 02:25:47] ERROR LoadError: Expected  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/app/models/archive\_page.rb  
to define ArchivePage  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active\_support/dependencies.rb:249:in  
`load_missing_constant' /usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active_support/dependencies.rb:452:in `const\_missing’  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active\_support/dependencies.rb:464:in  
`const_missing' /usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active_support/inflector.rb:250:in `constantize’

(…)  
/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

With webrick running if I modify the category page to this:

require ‘page’  
require ‘archive\_page’

class CategoryPage \< ArchivePage  
end

It works ok, but when I restart webrick i’ve got this error:

/_**/  
luke@darkstar:~/devel/covisa$ script/server  
=\> Booting WEBrick…  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/lib/annotatable.rb:44:in  
 `inherited_without_annotatable': stack level too deep (SystemStackError) from /usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/lib/annotatable.rb:44:in `inherited\_without\_annotatable’  
from  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/lib/annotatable.rb:44:in  
 `inherited' from /home/luke/devel/covisa/vendor/extensions/news_articles/app/models/category_page.rb:4 from /usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active_support/dependencies.rb:203:in `load\_without\_new\_constant\_marking’  
from  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active\_support/dependencies.rb:203:in  
 `load_file' from /usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in `new\_constants\_in’  
from  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active\_support/dependencies.rb:202:in  
 `load_file' from /usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active_support/dependencies.rb:94:in `require\_or\_load’  
… 30 levels…  
from  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/railties/lib/commands/server.rb:39  
from  
/usr/local/lib/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
 `gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’  
from script/server:3  
luke@darkstar:~/devel/covisa$  
/**_/

Someone can help?

## – Sylvestre Mergulhão - Free Software Development

[http://mergulhao.info](http://mergulhao.info)  
[http://www.euemeu.com](http://www.euemeu.com)

---

<div class="post-metadata">

**Author:** ![Sylvestre\_MergulhSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f17d59/32.png) [@Sylvestre\_MergulhSS](https://www.ruby-forum.com/u/Sylvestre_MergulhSS)\
**Post date:** [August 28, 2007, 6:45pm UTC](https://www.ruby-forum.com/t/trouble-with-inheritance-in-archivepage/113156/2 "2007-08-28T18:45:54Z")

</div>

Searching the list archive i’ve found this thread:  
[http://lists.radiantcms.org/pipermail/radiant/2007-March/003821.html](http://lists.radiantcms.org/pipermail/radiant/2007-March/003821.html)

So, its not possible to inherits from ArchivePage, but only from Page?

Thanks,

## – Sylvestre Mergulhão - Free Software Development

[http://mergulhao.info](http://mergulhao.info)  
[http://www.euemeu.com](http://www.euemeu.com)

---

<div class="post-metadata">

**Author:** ![Sylvestre\_MergulhSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f17d59/32.png) [@Sylvestre\_MergulhSS](https://www.ruby-forum.com/u/Sylvestre_MergulhSS)\
**Post date:** [August 29, 2007, 8:48am UTC](https://www.ruby-forum.com/t/trouble-with-inheritance-in-archivepage/113156/3 "2007-08-29T08:48:34Z")

</div>

> ```
> CategoryPage
> 
> ```
> 
> end

There’s no reason for that not to work.

Do you have any other extensions installed?  
Have you modified any of the core files?

Do you have files other than:

vendor/extensions/news\_articles/news\_articles\_extension.rb  
vendor/extensions/news\_articles/app/models/category\_page.rb

Is there any content in those files beyond what you’ve mentioned?

---

<div class="post-metadata">

**Author:** ![Sylvestre\_MergulhSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f17d59/32.png) [@Sylvestre\_MergulhSS](https://www.ruby-forum.com/u/Sylvestre_MergulhSS)\
**Post date:** [August 30, 2007, 1:04am UTC](https://www.ruby-forum.com/t/trouble-with-inheritance-in-archivepage/113156/4 "2007-08-30T01:04:49Z")

</div>

> Do you have any other extensions installed?

Yeap. Sean’s page\_attachment is instaled.

> Have you modified any of the core files?

No one. My radiant 0.6.2 is instaled as a gem.

> Do you have files other than:
> 
> vendor/extensions/news\_articles/news\_articles\_extension.rb  
> vendor/extensions/news\_articles/app/models/category\_page.rb

Only files created by extension generator.

I tried again here with a fresh install and fresh extension and the  
problem still occours.

> Is there any content in those files beyond what you’ve mentioned?  
> No, the contents is exact what I wrote here(copy and paste 😉

Can you try it in your workspace?

## – Sylvestre Mergulhão - Free Software Development

[http://mergulhao.info](http://mergulhao.info)  
[http://www.euemeu.com](http://www.euemeu.com)

---

<div class="post-metadata">

**Author:** ![Sylvestre\_MergulhSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f17d59/32.png) [@Sylvestre\_MergulhSS](https://www.ruby-forum.com/u/Sylvestre_MergulhSS)\
**Post date:** [August 30, 2007, 1:21am UTC](https://www.ruby-forum.com/t/trouble-with-inheritance-in-archivepage/113156/5 "2007-08-30T01:21:51Z")

</div>

> > Is there any content in those files beyond what you’ve mentioned?  
> > No, the contents is exact what I wrote here(copy and paste 😉
> 
> Can you try it in your workspace?

# cat new\_extension\_extension.rb

class NewExtensionExtension \< Radiant::Extension  
def activate  
CategoryPage  
end  
end

# cat app/models/category\_page.rb

class CategoryPage \< ArchivePage  
end

# ruby script/console

Loading development environment.

> > CategoryPage  
> > =\> CategoryPage

Seems to load up the extension fine. Have you tried without  
page\_attachments installed?

---

<div class="post-metadata">

**Author:** ![Sylvestre\_MergulhSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f17d59/32.png) [@Sylvestre\_MergulhSS](https://www.ruby-forum.com/u/Sylvestre_MergulhSS)\
**Post date:** [August 30, 2007, 6:47pm UTC](https://www.ruby-forum.com/t/trouble-with-inheritance-in-archivepage/113156/6 "2007-08-30T18:47:15Z")

</div>

On 8/29/07, Daniel S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> # ruby script/console
> 
> Loading development environment.
> 
> > > CategoryPage  
> > > =\> CategoryPage
> 
> Seems to load up the extension fine. Have you tried without page\_attachments installed?

Yeah. In console seems to load ok, but now, try start your webrick and  
acess radiant. Here produces this error:

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/  
mergulhao@pc325:~/devel/radiant$ script/server  
=\> Booting WEBrick…  
=\> Rails application started on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
=\> Ctrl-C to shutdown server; call with --help for options  
[2007-08-30 13:45:32] INFO WEBrick 1.3.1  
[2007-08-30 13:45:32] INFO ruby 1.8.4 (2005-12-24) [i486-linux]  
[2007-08-30 13:45:32] INFO WEBrick::HTTPServer#start: pid=11403  
port=3000  
127.0.0.1 - - [30/Aug/2007:13:45:39 BRT] “GET / HTTP/1.1” 200 0

- → /  
[2007-08-30 13:45:39] ERROR LoadError: Expected  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/app/models/archive\_page.rb  
to define ArchivePage  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active\_support/dependencies.rb:249:in  
`load_missing_constant' /usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active_support/dependencies.rb:452:in `const\_missing’  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active\_support/dependencies.rb:464:in  
`const_missing' /usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active_support/inflector.rb:250:in `constantize’  
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.2/vendor/rails/activesupport/lib/active\_support/core\_ext/string/inflections.rb:148:in  
`constantize’  
(…)  
/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

Yes I’ve tried without page\_attachments extension and the problem is  
the same. I don’t know what to do, but seems to be something related  
with load path, load order of files or something like this.

## – Sylvestre Mergulhão - Free Software Development

[http://mergulhao.info](http://mergulhao.info)  
[http://www.euemeu.com](http://www.euemeu.com)
