Error in Migration

I am a RoR newbie. I am getting this error when trying to migrate my 2.x
project to 3.x project.
actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:109:in
normalize_path': undefined methodto_sym’ for nil:NilClass
(NoMethodError)

In that line i can see the following code
options[$1.to_sym]||=/.+/?

why $1.to_sym ends with NilClass error

On Fri, May 17, 2013 at 12:37 AM, Amarnath K.
[email protected]wrote:

You’re getting NoMethodError because $1 in $1.to_sym is nil and nil
doesn’t
have a #to_sym method.

$1 gets set whenever you #match a string against a regular expression
that
has at least one capture group. By the time your line of code gets
executed, you clearly haven’t done so.

Also, the question mark at the end of the line as you’ve show it:

options[$1.to_sym]||=/.+/?

Is invalid (type it into an IRB session after initializing a local
variable
“options” to an empty hash and you’ll see that the parser things you’re
starting a ternary: “condition ? when-true : when-false” expression and
doesn’t consider the statement complete. Did you mean to have the “?”
after
the “+” inside the regular expression?

So, without more info on what you’re trying to get this line of code to
do
(what you expect $1 to be at this point, etc.) that’s all the help I can
give.