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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:20:51+00:00 2026-05-21T07:20:51+00:00

I’m trying to show wall posts that all users have made on a specific

  • 0

I’m trying to show “wall posts” that all users have made on a specific user’s page, but I’m having difficulty showing the correct posts.

Users controller:

def show
  @user = User.find_by_cached_slug(params[:id])
  @posts = Post.find_all_by_poster(params[@user.id])
  if signed_in?
    @post = Post.new
  end

  respond_to do |format|
    format.html # show.html.erb
    format.xml { render :xml => @user }
  end
end

Post form:

<%= form_for @post do |f| %>
  <div class="field">
    <%= f.text_area :content %>
  </div>
  <div class="field">
    <%= f.hidden_field :user_id, :value => current_user.id %>
  </div>
  <div class="field">
    <%= f.hidden_field :poster, :value => @user.id %.
  </div>
  <div class="actions">
    <%= f.submit "Submit" %>
  </div>
<% end %>

When a user creates a post the current_user id is saved in the posts table as the :user_id and the user id of the user’s page they’re posting on is saved as :poster. This part is working, but I don’t understand how to render @posts so that only the posts that have been made on that user’s page appear.

The approach I’m trying is somehow showing/filtering? all posts where :poster matches the user id of the user’s page; however, I don’t know how to make this work or if there is a better way. Any help?

Note: I’m using the slugged gem. In the Users/show view, I use <%= render @posts %>. Eventually, I’d like for users to be able to comment on posts, if that affects any design decisions.

Thanks very much for your help! Please let me know if any more information is needed.

  • 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-21T07:20:52+00:00Added an answer on May 21, 2026 at 7:20 am

    I think this line is the issue:

    @posts = Post.find_all_by_poster(params[@user.id])
    

    @user is the the record for the user who wall is now being viewed. (right?) You need all the posts that were posted to that users wall that is all the Post records where poster == @user.id. There is no need to look in the params hash for this. I believe that this line should instead be:

    @posts = Post.find_all_by_poster(@user.id)
    

    If this is incorrect, it means that I am not clear how your show action is meant to work. There are two different things that could be @user. By convention this should always refer to the record of the person at the other end of the connection. In your case, it looks like it instead refers to the person whose wall is being viewed. Is that correct?

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.