Trouble with inheritance in ArchivePage

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
=> 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://www.euemeu.com

Searching the list archive i’ve found this thread:
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://www.euemeu.com

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?

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 :wink:

Can you try it in your workspace?


Sylvestre Mergulhão - Free Software Development

http://mergulhao.info
http://www.euemeu.com

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

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?

On 8/29/07, Daniel S. [email protected] 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
=> 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://www.euemeu.com