質問

<%= render 'shared/modal',
    id: 'assignToModal', 
    button: '<button onclick="groupAssignTo('<%= _id %>');">Assign</button>' %>

Consider the above code in a rails app view file(.html.erb). It will throw a,

ActionView::Template::Error (/home/think/../app/views/junks/_abc.html.erb:39: 
syntax error, unexpected tIDENTIFIER, expecting keyword_end

Its because in the button local of the render statement, the single quote starts before < and does not end after >, instead ends before <%=

How to approach this?

役に立ちましたか?

解決

You are placing <%= %> tag inside another <%= %> tag

<%= render 'shared/modal',
    id: 'assignToModal', 
    button: '<button onclick="groupAssignTo(' + _id + ');">Assign</button>' %>
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top