简体   繁体   中英

Invalid regular expression flag in rails

I am having a link like the below in my rails application

          <%= link_to "Link ", "#", :onclick => "#{abc_path(:type => type)}" %>

which throws an error invalid regular expression flag l

how to resolve this ...

The onclick attribute in HTML needs to contain valid Javascript code.

What you have there is likely to produce something like:

<a href="#" onclick="/abc/foo?type=mytype">Link</a>

which will cause you problems because the browser can't run that as Javascript. If you let us know what you're trying to achieve then we can help you work out the right way to do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM