문제

<%= 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