【问题标题】:Heroku rails-problems ((syntax error, unexpected ',', expecting ')' in textarea-form-helper)Heroku rails-problems ((syntax error, unexpected ',', expecting ')' in textarea-form-helper)
【发布时间】:2012-07-18 23:10:17
【问题描述】:

我正在尝试将我的 rails 应用程序推送到 heroku cedar-stack 上。 在我的本地机器上一切正常(Ruby 版本 1.9.3 和 rails 版本 3.2.6)

当我将我的应用推送到 heroku 时,我的 _post_form-partial 中出现以下错误(请参阅下面的代码):

/app/app/views/posts/_post_form.html.erb:9: syntax error, unexpected ',', expecting ')'
2012-07-18T11:25:36+00:00 app[web.1]: ...:id =>"textarea", :cols => "5", :rows => "8", :class => "inp...
2012-07-18T11:25:36+00:00 app[web.1]: ...                               ^
2012-07-18T11:25:36+00:00 app[web.1]: /app/app/views/posts/_post_form.html.erb:9: syntax error, unexpected ',', expecting ')'
2012-07-18T11:25:36+00:00 app[web.1]: ...a", :cols => "5", :rows => "8", :class => "inputx-large boxs...
2012-07-18T11:25:36+00:00 app[web.1]: ...                               ^
2012-07-18T11:25:36+00:00 app[web.1]: /app/app/views/posts/_post_form.html.erb:9: syntax error, unexpected ')', expecting keyword_end
2012-07-18T11:25:36+00:00 app[web.1]: ... => "inputx-large boxsizing") );@output_buffer.safe_concat('
2012-07-18T11:25:36+00:00 app[web.1]: ...                               ^):

我真的不明白这里的问题。我做错了什么?

<div id="inputfield_visible_wrapper">
    <div class="well">
        <input type="text" id="inputfield_visible" class="input-xlarge boxsizing" value="Create Posting here">
    </div>
</div>
<div id="form_hidden_wrapper">
    <%= form_for Post.new, :html => { :class => "well" } do |f| %>
        <%= render "shared/posting_information" %>
        <%= f.text_area (:content, :id =>"textarea", :cols => "5", :rows => "8", :class => "inputx-large boxsizing") %>
        <%= f.submit "Post", :disabled => true, :id => "submit_button", :class => "btn btn-primary" %>
        <%= submit_tag "Cancel", :class => "btn", :id => "cancel_button", :type => "button" %>
        <div class="characters_left_wrapper">
            <span id="characters_left">100</span> <span class="hidden-phone">Characters left</span>
        </div>
        <div class="clear"></div>
    <% end %>
</div>

【问题讨论】:

  • 你应该删除f.text_area后面的空格。
  • 是的!而已!非常感谢!

标签: ruby-on-rails ruby heroku


【解决方案1】:

不要在括号前的方法上添加尾随空格:

<%= f.text_area (:content) %>

不好

<%= f.text_area(:content) %>

不错

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-06-22
    • 1970-01-01
    • 2022-12-13
    • 2011-01-10
    • 1970-01-01
    • 2016-06-17
    • 1970-01-01
    • 2022-08-22
    相关资源
    最近更新 更多