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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:57:31+00:00 2026-05-22T15:57:31+00:00

When a user makes a post on a profile, the profile owner’s user ID

  • 0

When a user makes a post on a profile, the profile owner’s user ID is saved as an integer in :poster (in the Post model). How do I find and render that user/user’s information?

More information:

  1. Using Slugged gem
  2. Trying to generate a feed of posts, when I call feed_item.user in my view, it directs me to the user that posted the post, but not to the user who’s profile the post was made on.

Feed Item View

enter image description here

Feed View

enter image description here

Pages Controller Home Function

enter image description here

@postee is my feeble attempt to find the user based on the user id saved for each post. Ideally I would like to be able to link to the user who’s profile the post was made on and also display information about that user in my view (e.g. the user’s username). I’ve been tinkering for a while and am stuck, any thoughts? Thank you very much for your help and please let me know if any additional information is needed!

EDIT

Post Form View

<%= form_for @post do |f| %>
<%= f.hidden_field :name, :value => current_user.name %>
<%= f.hidden_field :poster, :value => @user.id %>
<div class="postbox">

  <div class="postfield">
    <%= f.text_area :content %>
  </div>
  <div class="postsubmit">
    <%= f.submit "Submit" %>
  </div>
</div>

User Controller Show Action

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

respond_to do |format|
  format.html # show.html.erb
  format.xml { render :xml => @user }
end
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-22T15:57:32+00:00Added an answer on May 22, 2026 at 3:57 pm

    Ultimately, I decided to do it in a non-railsy way, just to get the functionality working. Though I suspect that if you can somehow tie the user id in :poster to a new model with (has many, belongs to, etc…) relationships set up, it would work much better that way. (I believe that this is what stephenmurdoch’s answer was attempting, there was just a problem with :user_id already being tied to the posting user.)

    I saved more user information when each post was made, and then rendered the profile post receiver’s information for each feed item. Also because user’s have unique URLs based on cached_slug, I was able to use <%= link_to feed_item.postername, feed_item.postercachedslug %> to create a link to the profile the post was made on.

    Post Form View

    <%= form_for @post do |f| %>
    <%= f.hidden_field :name, :value => current_user.name %>
    <%= f.hidden_field :poster, :value => @user.id %>
    <%= f.hidden_field :postername, :value => @user.name %>
    <%= f.hidden_field :posterusername, :value => current_user.username %>
    <%= f.hidden_field :postercachedslug, :value => @user.cached_slug %>
    <div class="postbox">
    
      <div class="field">
        <%= f.text_area :content %>
      </div>
      <div class="submit">
        <%= f.submit "Submit" %>
      </div>
    </div>
    

    Feed Item view

    <div class="profilepic">
    <% if feed_item.user.profile_file_name == nil %>
    <%= link_to image_tag("thumb.jpeg"), feed_item.user %>
    <% else %>
      <%= link_to image_tag(feed_item.user.profile.url(:thumb)), feed_item.user %>
     <% end %>
    </div>
    <span class='feeditem'>
        <div class='row1'>
          <strong>
            <span class="user"><%= link_to feed_item.name, feed_item.user %> </span>
          </strong>
          <%= image_tag("arrow.png") %>
          <span class="name"><%= link_to feed_item.postername, feed_item.postercachedslug %></span>
        </div>
      <div class='row2'>
        <span class="content"><%= feed_item.content %></span>
      </div>
      <div class='row3'>
    <span class="timestamp">
      <%= time_ago_in_words(feed_item.created_at) %> ago.
    </span>
        <% if current_user?(feed_item.user) %>
            <%= link_to "delete", feed_item, :method => :delete,
                        :confirm => "You sure?" %>
        <% end %>
      </div>
      </span>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Usecase: The user makes font customizations to an object on the design surface, that
I'm trying to make a pull down menu post a form when the user
My application makes use of a SQLite database to store the user's inputs. The
Problem: EmacsW32 is a version of Emacs that allows the user to make Emacs
Now that I can make useful user controls in WPF (thanks to this stackoverflow
I need to make sure that user can run only one instance of my
I have an extended UserProfile model in django: class UserProfile(models.Model): user = models.ForeignKey(User, unique=True)
In my app, I have a User model, which includes a number of attributes
So on my site, a user can post a comment on 2 things: a
Using Django 1.2, I'm running the django-registration application, and creating a User Profile object

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.