Failure to install Page Attachments extension

I’m trying to follow the instructions at
http://wiki.radiantcms.org/Installing_Extension_-_Page_Attachments. When
I get to this step:

rake production db:migrate:extensions

The output is:

rake aborted!
undefined method `[]’ for #Enumerable::Enumerator:0x24c267c

From that point on, my server will no longer start up as well.

This is on Leopard, with
ruby 1.8.7 (2008-06-09 patchlevel 17) [i686-darwin9.3.0]
rails 2.1.0

Any suggestions would be appreciated!

Matt Anderson wrote:

Any suggestions would be appreciated!

I just successfully installed Page Attachments on version 0.6.7.

I followed the guide (although much of it is outdated and no longer
necessary).

All you have to do is:

  1. Install attachment_fu:

$ svn export
http://svn.techno-weenie.net/projects/plugins/attachment_fu/
vendor/plugins/attachment_fu

  1. Download the page_attachments extension into the proper directory

$ cd /path/to/my/radiant/project
$ svn checkout
http://svn.radiantcms.org/radiant/trunk/extensions/page_attachments
vendor/extensions/page_attachments

  1. Now run the extension migrations:

$ rake production db:migrate:extensions

  1. Run the ‘update’ task to copy the appropriate assets from the
    page_attachments extension:

$ rake production radiant:extensions:page_attachments:update

  1. Restart your application and/or web server.

With Phusion Passenger:

$ cd tmp
$ touch restart.txt

I think your problem might be with ruby 1.8.7, there were some changes
to Enumerable::Enumerator that are possibly incompatible. Can you try
going back to 1.8.6 and see if you get the same error?

Ben M. wrote:

  1. Now run the extension migrations:

$ rake production db:migrate:extensions

Same result: after trying that command, the output was

rake aborted!
undefined method `[]’ for #Enumerable::Enumerator:0x26cbef0

Why should the user need to downgrade? 1.8.7 is the current stable
version of Ruby.

It is Radiant that needs to update. Or, if the devs can’t be bothered
doing that, at least post a notice on their website saying so.

john muhl wrote:

I think your problem might be with ruby 1.8.7

Reverting to 1.8.6 seems to have fixed it, guess I got ahead of Radiant
a bit…thanks!

Sho Fukamachi wrote:

Why should the user need to downgrade? 1.8.7 is the current stable
version of Ruby.

It is Radiant that needs to update. Or, if the devs can’t be bothered
doing that, at least post a notice on their website saying so.

Hear hear.

This mailer extension once worked I think. It still sends email but
now the attachment part doesn’t work. Am I crazy or missing
something? Okay I got the note in the todo list but hey this worked
just a couple of months ago. Does it work for other people?

Steven

We will heartily accept patches that resolve this issue while
maintaining compatibility with 1.8.6 and earlier.

Sean

Just for reference. I solved this with the patch provided in
http://www.mail-archive.com/[email protected]/msg528878.html.

Just add:

---- 8< ----
unless ‘1.9’.respond_to?(:force_encoding)
String.class_eval do
begin
remove_method :chars
rescue NameError
# OK
end
end
end
---- 8< ----

To your environment.rb (adding it to config/initializers/ as
suggested in
the URL above won’t work in Radiant).

/AITOR