简体   繁体   中英

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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