This project is archived and is in readonly mode.
Error when creating app from template: undefined method 'wrap' for Array:class
Reported by netshade | May 25th, 2010 @ 07:40 PM
When creating an app from a template, the following error occurs:
/Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.beta3/lib/rails/generators/actions.rb:116:in `block in environment': undefined method `wrap' for Array:Class (NoMethodError)
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/actions.rb:176:in `block in in_root'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/actions.rb:167:in `block in inside'
from /Users/netshade/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/fileutils.rb:121:in `chdir'
from /Users/netshade/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/fileutils.rb:121:in `cd'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/actions.rb:167:in `inside'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/actions.rb:176:in `in_root'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.beta3/lib/rails/generators/actions.rb:112:in `environment'
from /Users/netshade/opt/tools/rails_template/template.rb:146:in `block (2 levels) in apply'
from /Users/netshade/opt/tools/rails_template/template.rb:145:in `each'
from /Users/netshade/opt/tools/rails_template/template.rb:145:in `block in apply'
from /Users/netshade/opt/tools/rails_template/template.rb:11:in `git_commit_all'
from /Users/netshade/opt/tools/rails_template/template.rb:133:in `apply'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/actions.rb:204:in `instance_eval'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/actions.rb:204:in `apply'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.beta3/lib/rails/generators/rails/app/app_generator.rb:300:in `apply_rails_template'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/task.rb:33:in `run'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/invocation.rb:109:in `block in invoke'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/invocation.rb:118:in `each'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/invocation.rb:118:in `map'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/invocation.rb:118:in `invoke'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/group.rb:36:in `block in start'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/base.rb:378:in `start'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/thor-0.13.6/lib/thor/group.rb:29:in `start'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.beta3/lib/rails/commands/application.rb:13:in `<top (required)>'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.beta3/lib/rails/cli.rb:30:in `require'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.beta3/lib/rails/cli.rb:30:in `<top (required)>'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/rails-3.0.0.beta3/bin/rails:2:in `require'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/gems/rails-3.0.0.beta3/bin/rails:2:in `<top (required)>'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/bin/rails:19:in `load'
from /Users/netshade/.rvm/gems/ruby-1.9.2-head/bin/rails:19:in `<main>'
when the following environment call is made in the rails template:
[nil, :development, :test, :production].each do |env|
environment "\n", :env => env
end
The error is caused by Array.wrap (active_support/core_ext/array/wrap) not being included in railties/lib/rails/generators/actions.rb .
Comments and changes to this ticket
-
Jeff Kreeftmeijer May 26th, 2010 @ 09:42 AM
Can you add a failing test that passes when your previous patch is applied? :)
-
netshade May 26th, 2010 @ 09:16 PM
Not really. Classes supporting the test framework are pulling in active_support/core_ext/array/wrap , so a test of the given functionality won't fail (even though the functionality that causes this behavior is not currently being tested).
The classes pulling in array/wrap when testing are:
actionmailer/lib/action_mailer/railties/log_subscriber.rb:1
activesupport/lib/active_support/callbacks.rb:1
activesupport/lib/active_support/testing/assertions.rb:1I've included a patch that now tests the previously untested functionality of environment, as well as a succeeding and failing rails template that you can see the failure for yourself with:
rails fail -m ./fail_template.rb <- This breaks
rails nofail -m ./success_template.rb <- This doesn't -
Santiago Pastorino February 2nd, 2011 @ 04:52 PM
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 04:52 PM
- State changed from open to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>