Rails 4 link_to Destroy not working in Getting Started tutorial

前端 未结 13 1130
野性不改
野性不改 2020-11-27 04:48

I am working through the Getting Started tutorial (creating a Blog) and the link_to Destroy is not functioning properly. In the terminal it always interprets it as #SHOW. <

13条回答
  •  心在旅途
    2020-11-27 05:43

    I had exactly this problem and it was caused by triple-clicking the Guide's code block and copy/pasting the code straight into my editor (ST2 on OSX).

    You should check that the generated HTML for the link looks like this:

    Destroy Comment
    

    If it doesn't, but instead looks like the below, then the Javascript won't be applied:

    Destroy Comment
    

    The large gaps between the href and the unparsed Ruby are caused by the non-breaking spaces (unicode character \u00a0) used in the Guide being copied into your script.

    I'm not sure why this doesn't cause a script parse error.

提交回复
热议问题