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 8600103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:32:33+00:00 2026-06-12T01:32:33+00:00

I currently have an application that contains user statuses and support for comments on

  • 0

I currently have an application that contains user statuses and support for comments on these statues. Everything was working fine until I decided to render a comment form below each status. My create.js.erb prepends the newly created status to the user’s feed after successful submit. Here is my code:

This code renders individual statuses and is located in shared/feed_item

<li id="<%= feed_item.id %>" class="block">
  <%= feed_item.content %>
  <%= render 'shared/feed_comment_form', object: feed_item %> //works fine without this line
</li>

My create.js.erb for statuses

<% if @status.errors.any? %>
    $("#new_status").replaceWith("<%= escape_javascript(render('shared/status_form')) %>");
<% else %>
    $("<%= escape_javascript(render('shared/feed_item', feed_item: @status)) %>").hide().prependTo('.feed').fadeIn(1000);
<% end %>

shared/feed_comment_form

<%= form_for([object, @comment], :remote => true) do |f| %>
  <%= render 'shared/error_messages_short', object: @comment %>
  <div class="field">
    <%= f.text_area :content, placeholder: "Enter comment...", rows: 1 %>
  </div>
  <%= f.submit "Post", class: "status-btn", id: "status_submit_#{object.id}" %>
<% end %>

This is the error

Rendered statuses/create.js.erb (9.4ms)
Completed 500 Internal Server Error in 21ms

ActionView::Template::Error (undefined method `model_name' for NilClass:Class):
    1: <%= form_for([object, @comment], :remote => true) do |f| %>
    2:   <%= render 'shared/error_messages_short', object: @comment %>
    3:   <div class="field">
    4:     <%= f.text_area :content, placeholder: "Enter comment...", rows: 1 %>
  app/views/shared/_feed_comment_form.html.erb:1:in `_app_views_shared__feed_comment_form_html_erb__4480113129845938771_70094779148500'
  app/views/shared/_feed_item.html.erb:24:in `_app_views_shared__feed_item_html_erb___2728444254186520065_70094807848760'
  app/views/statuses/create.js.erb:4:in `_app_views_statuses_create_js_erb__3125686809617511276_70094769988780'
  app/controllers/statuses_controller.rb:6:in `create'

I don’t see why the variable ‘object’ is null because I am passing it ‘feed_item’ in shared/feed_item

Any help would be appreciated.

  • 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-06-12T01:32:35+00:00Added an answer on June 12, 2026 at 1:32 am

    Turns out @comment was actually nil and not ‘object’. I was passing in @comment from the controller and I guess it’s not passed to a render through ajax. I had to change @comment to Comment.new. Not sure if this is the best solution

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a UINavigationController based application that works just fine. I'd like to
I am working on splitting out an existing, working application that I currently have
I have an application I'm currently working on that requires Administrators to be able
I'm currently working with a part of my application that uses Dynamic Web User
I have a C# application with a user interface that contains options for the
We currently have a quite complex business application that contains a huge lot of
Currently on iOS 5 I have an iPhone application that contains web views which
I have an info dictionary that contains user data. Currently, it is written to
We currently have an application that depends largely on stored procedures. There is a
I currently have an application that uses a browserfield to access an internet page

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.