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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:41:52+00:00 2026-05-29T18:41:52+00:00

I have an and users can login and view their own profile with a

  • 0

I have an and users can login and view their own profile with a form to type in their status. What the user typed can only be seen by let say “his friends” right now, haven’t worked on that but “his friends” can’t see it. for example I run the up and without signing in I got to a user’s profile, without me signing in makes the app show the status the user typed and that’s when I get the error:
undefined method ‘content’ for nil:NilClass

here is my users controller:

    class UsersController < ApplicationController
 def show
@user = User.find(params[:id])
@microsposts = @user.microsposts.paginate(:page => params[:page])
end

 def create

    @microspost = current_user.microsposts.build(params[:microspost])

     if @microspost.save
        flash[:success] = "Micropost created!"
        redirect_to current_user
    else
       render 'home/index'
    end
  end


end

_microspost.html.erb:

  <%= microspost.content %>

_microspost_form.html.erb:

        <%= form_for @microspost do |f| %>
             <!--<render 'error_messages', :object => f.object %>-->
       <div class="field">
       <%= f.text_area :content %>
          </div>
      <div class="actions">
       <%= f.submit "Submit" %>
     </div>
  <% end %>

I’m stuck on this one I’m so frustrated, I’ve been working on an app daily from non til 4am, now I gotta stop 45mins early because I just can’t go on debugging this, it’s been 2 hours.

I appreciate the help guy and gals….

and here is part of show.html:

    <% unless @user.microsposts.empty? %>
        <table class="microposts" summary= "User microposts">
      <%= render 'microspost' %>
      </table>
        <!--will_paginate @microsposts %>-->

        <% end %>

          <td class="sidebar round">
            <strong>Name:</strong> <%= @user.username %><br />
             <strong>URL:</strong> <%= link_to user_path(@user), @user %><br />
      <strong>Microposts:</strong><%= @user.microsposts.count %>
     </td>
     <% if signed_in? %>
        <table class = "front" summary="For signed in users">
  <tr>
    <td class="main">
        <h1 class="micropost">What you doin?</h1>
        <%= render 'microspost_form' %>
        </td>
        <td class ="sidebar round">
            <%= render 'user_info' %>
            </td>
            </tr>
            </table>
            <% else %>
            <h1>testing test</h1>
            <% end %>

  • 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-29T18:41:54+00:00Added an answer on May 29, 2026 at 6:41 pm

    Try to replace <%= render 'microspost' %> with

    • <%= @user.microsposts %> if @user.microsposts is an objet of class Micropost

    • <%= render :partial => 'microspost', :object => @user.microsposts %> otherwise

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

Sidebar

Related Questions

i have a mini app where users can login, view their profile, and follow
I have an application where multiple users can login(not simultaneously though!only a single user
I have website where users can login with their Facebook account. I am using
I have a view that returns users projects and also their windows login. An
I have created a User called Student and Teacher that can login into the
I have a Login dialog that can create an alert dialog when the user
I have several sites where users can send me email through an html form
I already have written a login and register script. The user can login to
I have users and contacts. Users sign into their account and can create address
I have a site where users can log in and check on outstanding support

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.