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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:38:27+00:00 2026-06-11T15:38:27+00:00

Here is the users show view where they are supposed to show up. ..

  • 0

Here is the users show view where they are supposed to show up. ..

edit (I have updated this post slightly you can see it at RoR: How can I get my microposts to show up?)

<section>
  <div id= "purchases">
    <%= render 'shared/micropost_form_purchase' %>
  </div>
  <div id="sales">
    <%= render 'shared/micropost_form_sale' %>
  </div>
</section>

<div id="purchases list">
  <ol class="microposts">
    <%= render @purchases unless @purchases.nil? %>
  </ol>
</div>

<div id="sales list">
  <ol class="microposts">
    <%= render @sales unless @sales.nil? %>
  </ol>
</div>

so the forms (partials) are loading fine, but then when I make a post, in either one, neither the purchases list nor the sales list shows up. I checked the database and they are being created along with an entry in the column indicating kind (either sale or purchase)

Here are the forms:

<%= form_for (@micropost) do |f| %>

  <div class="field no-indent">
    <%= f.text_area :content, placeholder: "What's something else you want to buy?" %>
    <%= hidden_field_tag 'micropost[kind]', "purchase" %>
  </div>
  <%= f.submit "Post", class: "btn btn-large btn-primary" %>
<% end %>

and

<%= form_for (@micropost) do |f| %>

  <div class="field no-indent">
    <%= f.text_area :content, placeholder: "What's something else you want to buy?" %>
    <%= hidden_field_tag 'micropost[kind]', "sale" %>
  </div>
  <%= f.submit "Post", class: "btn btn-large btn-primary" %>
<% end %>

also, here is the show part of the users_controller.rb

 def show
    @user = User.find(params[:id])
    @micropost=Micropost.new
    @microposts = @user.microposts.paginate(page: params[:page])
  end

and here is the show part of the microposts_controller.rb

def show

    @micropost = Micropost.find(params[:id])
    @microposts = Micropost.where(:user_id => @user.id)
    @purchases = @microposts.where(:kind => "purchase")
    @sales = @microposts.where(:kind => "sale")

  end

can anyone help me out? anything else i need? hmmm

  • 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-11T15:38:28+00:00Added an answer on June 11, 2026 at 3:38 pm

    First, just to be sure you are getting the results you want, you should try something like this in your view

    <%= @sales %>
    

    This should be a hash of the results you want. Then, if that looks good, you want to do something like this

    <div id="sales_list">
      <ol class="microposts">
        <% if @sales.any? %>
          <% @sales.each do |sale| %>
            <li><%= sale %></li>
          <% end %>
        <% end %>
      </ol>
    </div>
    

    And repeat for purchases

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

Sidebar

Related Questions

Here is the users show view where they are supposed to show up. ..
In my system Users can add/edit/view Customers . I would like to add a
I have an app with Photos. Users can view photos directly from a link
I have a view that dynamically updates depending on user input - here's how
I've got 3 tables that are something like this (simplified here ofc): users user_id
Here is my problem in codeigniter MVC. Suppose I have 3 models: (users, email
I have the table users and scores . Here are the associations: belongs_to :user
Is there a way to start an activity from a view? I have this
I'm making a game link site, where users can post links to their favorite
I have my main view, and when a user taps a 'Show' button I

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.