简体   繁体   English

Rails 3 client_side_validations给出编译错误(我正在使用设计)

[英]Rails 3 client_side_validations giving a compile error ( I am using devise)

I am getting the below error when using client_side_validations...I have put my source below.. The form is nothing complex, it is a simple form I am using with devise...Can someone help me what is the issue.. 我在使用client_side_validations时收到以下错误...我已将我的源码放在下面..表单并不复杂,它是一个简单的表单,我正在使用设计......有人可以帮助我什么是问题..

Error: 错误:

compile error
C:/project/madhu_ar/app/views/profiles/new.html.erb:2: syntax error, unexpected tASSOC, expecting kEND
...rm_for(@profile), :validate => true do |f| @output_buffer.sa...
                              ^
C:/project/madhu_ar/app/views/profiles/new.html.erb:54: syntax error, unexpected kENSURE, 
expecting $end

My Source is like this :

<h1>Business Profile Setup </h1>
<%= form_for(@profile), :validate => true do |f| %>

<div class="field">
    <%= f.label :businessname %>
    <br />
    <%= f.text_field :businessname %>
</div>
<div class="field">
    <%= f.label :addressline1 %>
    <br />
    <%= f.text_field :addressline1 %>
</div>

Regards Madhukar 关心Madhukar

Your closing parenthesis is in the wrong place, this: 你的右括号是在错误的地方,这个:

<%= form_for(@profile), :validate => true do |f| %>

should be: 应该:

<%= form_for(@profile, :validate => true) do |f| %>

or just: 要不就:

<%= form_for @profile, :validate => true do |f| %>

The form_for helper wants the object as the first argument and the options hash as the second; form_for帮助器希望将对象作为第一个参数,将选项哈希作为第二个参数; why say form_for(@profile), :validate => true , you're giving form_for its first argument and then following that method call with a comma and a symbol and that's invalid syntax. 为什么说form_for(@profile), :validate => true ,你给form_for它的第一个参数,然后用逗号和符号跟随该方法调用,这是无效的语法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM