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

发布于 2024-12-02 19:53:40 字数 891 浏览 1 评论 0原文

使用 client_side_validations 时出现以下错误...我已将源代码放在下面..该表单并不复杂,它是我与 devise 一起使用的简单表单...有人可以帮我解决问题吗..

错误:

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>

问候 马杜卡

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

海螺姑娘 2024-12-09 19:53:40

您的右括号位于错误的位置,这:

<%= 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 它的第一个参数,然后在该方法调用后面加上逗号和符号,这是无效的语法。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文