# Error in Migration

**URL:** <https://www.ruby-forum.com/t/error-in-migration/229036>\
**Category:** Ruby\
**Created:** [May 17, 2013, 8:37am UTC](https://www.ruby-forum.com/t/error-in-migration/229036 "2013-05-17T08:37:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ami199102](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c5a1d2/32.png) [@ami199102](https://www.ruby-forum.com/u/ami199102)\
**Post date:** [May 17, 2013, 8:37am UTC](https://www.ruby-forum.com/t/error-in-migration/229036/1 "2013-05-17T08:37:35Z")

</div>

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 method`to\_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

---

<div class="post-metadata">

**Author:** ![ami199102](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c5a1d2/32.png) [@ami199102](https://www.ruby-forum.com/u/ami199102)\
**Post date:** [May 17, 2013, 3:13pm UTC](https://www.ruby-forum.com/t/error-in-migration/229036/2 "2013-05-17T15:13:56Z")

</div>

On Fri, May 17, 2013 at 12:37 AM, Amarnath K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)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.
