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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:44:48+00:00 2026-06-17T07:44:48+00:00

I am a beginner working on a RoR app that allows users to update

  • 0

I am a beginner working on a RoR app that allows users to update their resume with experiences and education. I have two models for these different items and would like to display them together in chronological order. I want to know how to set this up in my profile controller and view.

I’d like to adopt this same practice to a separate part of the app that will combine post and discussion items from users in the same way. However, currently, my focus is on the experience and education portion.

profiles/show.html.erb:

    <% if @experiences.any? or @educations.any? %>
<div class="postExpOuter">
    <% @experiences.each do |experience| %>
            <div class="postExp">
                <div>
                    <h2><%= experience.position %></h2>
                    <h3><%= experience.company %> | <%= experience.location %></h3>
                    <h4>
                        <%= experience.start_month %> <%= experience.start_year %>
                        <% if experience.end_year %>
                            <%= " - " + experience.end_month %> <%= experience.end_year %>
                        <% else %>
                            <span> - Present</span>
                        <% end %>
                    </h4>
                </div>
            </div>
    <% end %>
    <% @educations.each do |education| %>
            <div class="postExp">
                <div>
                    <h2><%= education.degree %></h2>
                    <h3><%= education.school %></h3>
                    <h4>
                        <% if education.end_year %>
                            <span>Class of </span><%= education.end_year %>
                        <% else %>
                            <%= education.start_year %><span> - Present</span>
                        <% end %>
                    </h4>
                </div>
            </div>
    <% end %>
</div>
<% 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-06-17T07:44:49+00:00Added an answer on June 17, 2026 at 7:44 am

    profiles_controller.rb:

    class ProfilesController < ApplicationController
      def show
        @user = User.find_by_profile_name(params[:id])
        if @user
            @posts = @user.posts.all(:order => "created_at DESC", :limit => 3)
            @experiences = @user.experiences.all(:order => "start_year DESC")
            @educations = @user.educations.all(:order => "start_year DESC")
    
          @items = (@experiences.to_a + @educations.to_a).sort_by(&:start_year).reverse[0,3]
    
            render action: :show
        else
            render file: 'public/404', status: 404, formats: [:html] 
        end
      end
    end
    

    profiles/show.html.erb:

    <% if @items.any? %>
    <div class="postExpOuter">
        <% @items.each do |item| %>
          <% if item.is_a? Experience %>
           <div class="postExp">
                <div>
                    <h2><%= item.position %></h2>
                    <h3><%= item.company %> | <%= item.location %></h3>
                    <h4>
                        <%= item.start_month %> <%= item.start_year %>
                        <% if item.end_year %>
                            <%= " - " + item.end_month %> <%= item.end_year %>
                        <% else %>
                            <span> - Present</span>
                        <% end %>
                    </h4>
                </div>
            </div>
          <%- else -%>
            <div class="postExp">
                <div>
                    <h2><%= item.degree %></h2>
                    <h3><%= item.school %></h3>
                    <h4>
                        <% if item.end_year %>
                            <span>Class of </span><%= item.end_year %>
                        <% else %>
                            <%= item.start_year %><span> - Present</span>
                        <% end %>
                    </h4>
                </div>
            </div>
          <% end %>
        <% end %>
    </div>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a beginner and working on joomla 1.5. I have two question :
Hi I'm a super beginner and working on my first app, I have a
I'm working on a beginner's java app that converts infix expressions to postfix, then
I'm a beginner programmer and am working on an email confirmation. Once users have
I am a beginner to the iOS app development and working on a sample
I am a beginner-verging-on-intermediate rails developer that is working hard to improve my skills.
As a beginner in Ocaml, I have this current working code: ... let ch_in
I'm working on a Django 1.2 app and I'm a kind of beginner with
i'm a beginner programmer and i'm currently working on a basic navigation app. I
i am beginner in Android app development i am working on a app which

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.