Rails strange error => IndexError: string not matched

前端 未结 2 1705
面向向阳花
面向向阳花 2021-01-07 17:33

I\'ve got a very strange message error. I think it\'s not coming from Ruby but from the unix system.

So, I have the following test file:

require File         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-07 17:59

    This happens, for example, when you try to access a string variable as a Hash by mistake.

    s = "a string"
    s["position"] = "an other string"
    
    IndexError: string not matched
        from (irb):5:in `[]='
        from (irb):5
    

    Additional Information

提交回复
热议问题