1

I have following file. Displaying error:

SyntaxError (/home/ubuntu/workspace/app/views/responses/destroy.js.erb:1: syntax error, unexpected =>, expecting ')'
....append=( j render (:partial => "projects/new_response", :lo...

I cant found, what wrong with code?

destroy.js.erb

$('.responses').replaceWith('<%= j render (:partial => "projects/new_response", :locals => { project: @project } )%> ');

How write correct?

1
  • Can you try 1) removing the space after render here: render (:partial ...) or 2, leave the space, but remove the brackets around (:partial => ...)? Commented May 6, 2016 at 8:28

1 Answer 1

1

Remove the space here:

#     |-  HERE
render(:partial => 

Or, surround your j method call params. Basically, Ruby can't figure out which is whose params when you have hash in your arguments list:

j(render (:partial =>  ...) )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.