Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7514321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:27:40+00:00 2026-05-30T00:27:40+00:00

I clicked the comment link (to post, not read, a comment) in the Enki

  • 0

I clicked the comment link (to post, not read, a comment) in the Enki blogging gem and it gave me this error message

ArgumentError in Posts#show

wrong number of arguments (2 for 1)
Extracted source (around line #27):

But I can’t figure out what the two arguments are that it’s sending. Note that I had already created one post with no comments on it.

This is the controller action show

 def show
    @post = Post.find_by_permalink(*([:year, :month, :day, :slug].collect {|x| params[x] } << {:include => [:approved_comments, :tags]}))
    @comment = Comment.new
  end

this is the link I’m clicking in views/posts/index.html.erb to make a comment

<li class="comments"><%= link_to(pluralize(post.approved_comments.size, "comment"), post_path(post, :anchor => 'comments')) %></li>

This is the error message on the screen. Any suggestions how I might go about trying to figure out what’s going on?

Rspec tests (Note, I haven’t created any comments so I don’t know why it’s expecting one)

    1) DeletePostUndo#process! creates a new post with comments based on the attributes stored in #data
         Failure/Error: new_post.comments.count.should == 1
           expected: 1
                got: 0 (using ==)
         # ./spec/models/delete_post_undo_spec.rb:11:in `block (3 levels) in <top (required)>'

   2) /posts/show.html.erb should render a post
     Failure/Error: render :template => "/posts/show.html.erb"
     ActionView::Template::Error:
       wrong number of arguments (2 for 1)
     # ./app/helpers/url_helper.rb:9:in `post_comments_path'
     # ./app/views/posts/show.html.erb:27:in `_app_views_posts_show_html_erb___532600282027141355_2210809080'
     # ./spec/views/posts/show.html.erb_spec.rb:45:in `block (2 levels) in <top (required)>'

Error Message on localhost:3000

ArgumentError in Posts#show

Showing /Users/mm/Sites/trenchstory/app/views/posts/show.html.erb where line #27 raised:

wrong number of arguments (2 for 1)
Extracted source (around line #27):

24:       <% end -%>
25:     </ul>
26:   </div>
27:   <% end -%>
28: <%= form_for([@post, @comment]) do |form| -%>
29:   <div>
30:     <p><%= form.text_field 'author' %><label for="comment_author"><small>Name or <a href="http://openidexplained.com/">OpenID</a> (required)</small></label></p>
Rails.root: /Users/mm/Sites/trenchstory

Application Trace | Framework Trace | Full Trace
app/helpers/url_helper.rb:9:in `post_comments_path'
app/views/posts/show.html.erb:27:in `_app_views_posts_show_html_erb___852287167798563826_2191478080'
Request

Parameters:

{"year"=>"2012",
 "month"=>"02",
 "day"=>"16",
 "slug"=>"my-first-post"}
Show session dump

_csrf_token: "OogtzfpSz3JylLAjvBdnBkn/Ti4RdAc+sbuGXeREqHA="
logged_in: true
session_id: "b045900073f1eed9a9880ff4ead34d07"
warden.user.user.key: ["User", [1], "$2a$10$9C.WngPResjBHCQ/vXK0JO"]
Show env dump

GATEWAY_INTERFACE: "CGI/1.1"
HTTP_ACCEPT: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
HTTP_ACCEPT_CHARSET: "ISO-8859-1,utf-8;q=0.7,*;q=0.3"
HTTP_ACCEPT_ENCODING: "gzip,deflate,sdch"
HTTP_ACCEPT_LANGUAGE: "en-US,en;q=0.8"
REMOTE_ADDR: "127.0.0.1"
REMOTE_HOST: "activate.adobe.com"
SERVER_NAME: "localhost"
SERVER_PROTOCOL: "HTTP/1.1"
Response

Headers:

None

Update

views/posts/show.html.erb (see the partial below)

  <% content_for(:head) do -%>
      <%= javascript_include_tag 'common' %>
      <%= javascript_include_tag 'live-comment-preview' %>
    <% end -%>
    <% content_for(:page_title) do -%>
    <%= post_title(@post) -%>
    <% end -%>
    <%= render :partial => 'posts/post', :locals => {:post => @post} %>
    <ol class="commentlist">
      <% @post.approved_comments.each do |comment| -%>
      <li<%=raw cycle(' class="alt"', '') %> id="comment-<%= comment.id %>">
        <%= render :partial => 'comments/comment', :locals => {:comment => comment} %>
      </li>
      <% end -%>
    </ol>
    <div class="related">Looking for more? Head on over to the <%= link_to("archives", archives_path) %>.</div>
    <h2>Post a comment</h2>
      <% unless @comment.errors.empty? -%>
      <div class="errors">
        <h3>Comment not added!</h3>
        <ul>
          <% @comment.errors.sort_by(&:first).each do |error| -%>
            <li><%= format_comment_error(error) %></li>
          <% end -%>
        </ul>
      </div>
      <% end -%>
    <%= form_for([@post, @comment]) do |form| -%>
      <div>
        <p><%= form.text_field 'author' %><label for="comment_author"><small>Name </small></label></p>
        <p><%= form.text_area 'body' %><br><small>(<a href="http://lesstile.rubyforge.org">lesstile enabled</a> - surround code blocks with ---)</small></p>
        <p><%= submit_tag "Add Comment" %></p>
      </div>
    <% end -%>

partial rendered in app views posts show

<h2><%= link_to(post.title, post_path(post)) %></h2>
<div class="entrybody">
  <%=raw post.body_html %>
</div>
<div class="meta">
  <ul>
    <li class="date">Posted on <%= format_post_date(post.published_at) %></li>
    <li class="comments"><%= link_to(pluralize(post.approved_comments.size, "comment"), post_path(post, :anchor => 'comments')) %></li>
    <% unless post.tags.empty? -%>
    <li class="tags">Tagged <%= linked_tag_list(post.tags) %></li>
    <% end -%>
  </ul>
</div>

Rake routes

  forem        /forums                                         {:to=>Forem::Engine}
        new_user_session GET    /users/sign_in(.:format)                        {:action=>"new", :controller=>"devise/sessions"}
            user_session POST   /users/sign_in(.:format)                        {:action=>"create", :controller=>"devise/sessions"}
    destroy_user_session DELETE /users/sign_out(.:format)                       {:action=>"destroy", :controller=>"devise/sessions"}
           user_password POST   /users/password(.:format)                       {:action=>"create", :controller=>"devise/passwords"}
       new_user_password GET    /users/password/new(.:format)                   {:action=>"new", :controller=>"devise/passwords"}
      edit_user_password GET    /users/password/edit(.:format)                  {:action=>"edit", :controller=>"devise/passwords"}
                         PUT    /users/password(.:format)                       {:action=>"update", :controller=>"devise/passwords"}
cancel_user_registration GET    /users/cancel(.:format)                         {:action=>"cancel", :controller=>"devise/registrations"}
       user_registration POST   /users(.:format)                                {:action=>"create", :controller=>"devise/registrations"}
   new_user_registration GET    /users/sign_up(.:format)                        {:action=>"new", :controller=>"devise/registrations"}
  edit_user_registration GET    /users/edit(.:format)                           {:action=>"edit", :controller=>"devise/registrations"}
                         PUT    /users(.:format)                                {:action=>"update", :controller=>"devise/registrations"}
                         DELETE /users(.:format)                                {:action=>"destroy", :controller=>"devise/registrations"}
           admin_session POST   /admin/session(.:format)                        {:action=>"create", :controller=>"admin/sessions"}
       new_admin_session GET    /admin/session/new(.:format)                    {:action=>"new", :controller=>"admin/sessions"}
      edit_admin_session GET    /admin/session/edit(.:format)                   {:action=>"edit", :controller=>"admin/sessions"}
                         GET    /admin/session(.:format)                        {:action=>"show", :controller=>"admin/sessions"}
                         PUT    /admin/session(.:format)                        {:action=>"update", :controller=>"admin/sessions"}
                         DELETE /admin/session(.:format)                        {:action=>"destroy", :controller=>"admin/sessions"}
     preview_admin_posts POST   /admin/posts/preview(.:format)                  {:action=>"preview", :controller=>"admin/posts"}
             admin_posts GET    /admin/posts(.:format)                          {:action=>"index", :controller=>"admin/posts"}
                         POST   /admin/posts(.:format)                          {:action=>"create", :controller=>"admin/posts"}
          new_admin_post GET    /admin/posts/new(.:format)                      {:action=>"new", :controller=>"admin/posts"}
         edit_admin_post GET    /admin/posts/:id/edit(.:format)                 {:action=>"edit", :controller=>"admin/posts"}
              admin_post GET    /admin/posts/:id(.:format)                      {:action=>"show", :controller=>"admin/posts"}
                         PUT    /admin/posts/:id(.:format)                      {:action=>"update", :controller=>"admin/posts"}
                         DELETE /admin/posts/:id(.:format)                      {:action=>"destroy", :controller=>"admin/posts"}
     preview_admin_pages POST   /admin/pages/preview(.:format)                  {:action=>"preview", :controller=>"admin/pages"}
             admin_pages GET    /admin/pages(.:format)                          {:action=>"index", :controller=>"admin/pages"}
                         POST   /admin/pages(.:format)                          {:action=>"create", :controller=>"admin/pages"}
          new_admin_page GET    /admin/pages/new(.:format)                      {:action=>"new", :controller=>"admin/pages"}
         edit_admin_page GET    /admin/pages/:id/edit(.:format)                 {:action=>"edit", :controller=>"admin/pages"}
              admin_page GET    /admin/pages/:id(.:format)                      {:action=>"show", :controller=>"admin/pages"}
                         PUT    /admin/pages/:id(.:format)                      {:action=>"update", :controller=>"admin/pages"}
                         DELETE /admin/pages/:id(.:format)                      {:action=>"destroy", :controller=>"admin/pages"}
          admin_comments GET    /admin/comments(.:format)                       {:action=>"index", :controller=>"admin/comments"}
                         POST   /admin/comments(.:format)                       {:action=>"create", :controller=>"admin/comments"}
       new_admin_comment GET    /admin/comments/new(.:format)                   {:action=>"new", :controller=>"admin/comments"}
      edit_admin_comment GET    /admin/comments/:id/edit(.:format)              {:action=>"edit", :controller=>"admin/comments"}
           admin_comment GET    /admin/comments/:id(.:format)                   {:action=>"show", :controller=>"admin/comments"}
                         PUT    /admin/comments/:id(.:format)                   {:action=>"update", :controller=>"admin/comments"}
                         DELETE /admin/comments/:id(.:format)                   {:action=>"destroy", :controller=>"admin/comments"}
    undo_admin_undo_item POST   /admin/undo_items/:id/undo(.:format)            {:action=>"undo", :controller=>"admin/undo_items"}
        admin_undo_items GET    /admin/undo_items(.:format)                     {:action=>"index", :controller=>"admin/undo_items"}
                         POST   /admin/undo_items(.:format)                     {:action=>"create", :controller=>"admin/undo_items"}
     new_admin_undo_item GET    /admin/undo_items/new(.:format)                 {:action=>"new", :controller=>"admin/undo_items"}
    edit_admin_undo_item GET    /admin/undo_items/:id/edit(.:format)            {:action=>"edit", :controller=>"admin/undo_items"}
         admin_undo_item GET    /admin/undo_items/:id(.:format)                 {:action=>"show", :controller=>"admin/undo_items"}
                         PUT    /admin/undo_items/:id(.:format)                 {:action=>"update", :controller=>"admin/undo_items"}
                         DELETE /admin/undo_items/:id(.:format)                 {:action=>"destroy", :controller=>"admin/undo_items"}
            admin_health        /admin/health(/:action)(.:format)               {:action=>"index", :controller=>"admin/health"}
              admin_root        /admin(.:format)                                {:controller=>"admin/dashboard", :action=>"show"}
                archives GET    /archives(.:format)                             {:action=>"index", :controller=>"archives"}
                    page GET    /pages/:id(.:format)                            {:action=>"show", :controller=>"pages"}
                         GET    /:year/:month/:day/:slug/comments(.:format)     {:year=>/\d{4}/, :month=>/\d{2}/, :day=>/\d{2}/, :controller=>"comments", :action=>"index"}
                         POST   /:year/:month/:day/:slug/comments(.:format)     {:year=>/\d{4}/, :month=>/\d{2}/, :day=>/\d{2}/, :controller=>"comments", :action=>"create"}
                         GET    /:year/:month/:day/:slug/comments/new(.:format) {:year=>/\d{4}/, :month=>/\d{2}/, :day=>/\d{2}/, :controller=>"comments", :action=>"new"}
                         GET    /:year/:month/:day/:slug(.:format)              {:year=>/\d{4}/, :month=>/\d{2}/, :day=>/\d{2}/, :controller=>"posts", :action=>"show"}
         formatted_posts GET    /posts.:format                                  {:controller=>"posts", :action=>"index"}
                   posts GET    /(:tag)(.:format)                               {:controller=>"posts", :action=>"index"}
                    root        /                                               {:controller=>"posts", :action=>"index"}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:27:42+00:00Added an answer on May 30, 2026 at 12:27 am

    As Azolo pointed out, Enki defines its own post_comments_path helper. The problem is Enki’s doesn’t take an options parameter like the Rails helpers do. So form_for ends up passing an option of :format => nil, expecting the Rails-style helper.

    You can either fix this by adding options = {} to the end of Enki’s post_comments_path, or by giving form_for an explicit URL:

    form_for(@comment, :url => post_comments_path(@post), :method => :post)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I clicked on the link Add comment. Appears comment form, with help of
When a ComboBox is clicked this causes it to be selected in the window.
when the preview link is clicked it is meant to change the video script
I have this code in my view.. <span class=bold>Comment: <%=Html.TextAreaFor(model => model.Comment, new {
I am using Facebook in my music application where user post comment on wall
I want to create an ajax delete call. When the link is clicked, the
i have this bit of html. (Link at bottom) Its output of php code
I am trying to create a comment form for posts on my website. I
This is regarding Patrick DW's comment on my answer to this question. Multiple selectors:
Currently, I have a button called 'Comment' that when clicked slides down a comment

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.