在js.erb文件中使用局部变量渲染部分 - 意外=>,期待')'

时间:2016-05-06 08:20:33

标签: ruby-on-rails

我有以下文件。显示错误:

self.tfEmailId.leftViewMode = UITextFieldViewModeAlways;
UIImageView *imgSearch=[[UIImageView alloc] initWithFrame:CGRectMake(5, 0, 25, self.tfEmailId.frame.size.height-5)];
[imgSearch setImage:[UIImage imageNamed:@"Emailid@1x"]];
self.tfEmailId.leftView = imgSearch;
self.tfEmailId.clipsToBounds=YES;

我发现,代码有什么问题?

destroy.js.erb

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

如何写正确?

1 个答案:

答案 0 :(得分:1)

删除此处的空格:

#     |-  HERE
render(:partial => 

或者,围绕您的j方法调用参数。基本上,当你在参数列表中有哈希时,Ruby无法弄清楚哪个是params:

j(render (:partial =>  ...) )