0

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..

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

4

1 回答 1

2

你的右括号在错误的地方,这个:

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

应该:

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

要不就:

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

助手希望对象作为第form_for一个参数,选项哈希作为第二个参数;为什么说form_for(@profile), :validate => true,你给出form_for了它的第一个参数,然后用逗号和符号跟随该方法调用,这是无效的语法。

于 2011-09-03T20:23:46.277 回答