# Rake: undefined method \`to\_sym' for :Array

**URL:** <https://www.ruby-forum.com/t/rake-undefined-method-to-sym-for-array/149850>\
**Category:** Ruby\
**Created:** [September 30, 2008, 3:18pm UTC](https://www.ruby-forum.com/t/rake-undefined-method-to-sym-for-array/149850 "2008-09-30T15:18:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldbug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c0e974/32.png) [@oldbug](https://www.ruby-forum.com/u/oldbug)\
**Post date:** [September 30, 2008, 3:18pm UTC](https://www.ruby-forum.com/t/rake-undefined-method-to-sym-for-array/149850/1 "2008-09-30T15:18:48Z")

</div>

When I run the example given in the rake documentation under “Tasks  
that expect parameters”, namely:

task :name, [:first\_name, :last\_name] do |t, args|  
args.with\_defaults(:first\_name =\> “John”, :last\_name =\> “Dough”)  
puts “First name is #{args.first\_name}”  
puts “Last name is #{args.last\_name}”  
end

I get the following error:

$ rake -f foo.rb  
(in C:/home/wpd/ruby/gdsii)  
rake aborted!  
undefined method `to\_sym’ for [:first\_name, :last\_name]:Array  
C:/home/wpd/ruby/gdsii/foo.rb:1  
(See full trace by running task with --trace)

Any clues where to start to track this down? I am running rake  
version 0.8.1 on top of Ruby 1.8.6 (on an XP platform, if that  
matters).

Also, as long as I’m in the neighborhood, the documentation on  
[rake.rubyforge.org](http://rake.rubyforge.org) states:

“Tasks that use parameters have a slightly different format for  
prerequisites. Use the :needs keyword to specify the prerequisites for  
tasks with arguments. For example: " … but the example that follows  
doesn’t show the use of the “:needs” keyword”.

(This hasn’t been an issue for me yet, but I happened to notice that  
as I read the docs and wondered about it at the time.)

–wpd

---

<div class="post-metadata">

**Author:** ![oldbug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c0e974/32.png) [@oldbug](https://www.ruby-forum.com/u/oldbug)\
**Post date:** [September 30, 2008, 9:05pm UTC](https://www.ruby-forum.com/t/rake-undefined-method-to-sym-for-array/149850/2 "2008-09-30T21:05:56Z")

</div>

This appears to be a 0.8.1 problem – at least, it went away when I I  
did a “gem update rake” (and was updated to 0.8.3).

–wpd
