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

  • Home
  • SEARCH
  • 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 6933881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:53:21+00:00 2026-05-27T11:53:21+00:00

I am using rails 3.1.3, postgreql9.1 and ruby 1.9.3. I would like to add

  • 0

I am using rails 3.1.3, postgreql9.1 and ruby 1.9.3.

I would like to add a column to an existing database that is really the concatenation of two existing columns, namely; first_name and last_name.

How does one go about doing this?

The reason I want the fullname is that when it comes time to display the employees, I would like to just show the fullname, but I need the name split up into two parts for other functions.

Also part of this question is that while I only want the fullname of the employee to show on a report, I would also like the employees email and primary position to show and then to have a link, called info, which when clicked will give a detailed report on the employee showing all the attributes in the employee table.

So far, I have a rudimentary employee page.

Any reader have the patience and willingness to share some pointers, guidance and or advice on how to go about this task?

Thanks,

Tom.

  • 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-27T11:53:22+00:00Added an answer on May 27, 2026 at 11:53 am

    If you need to create the real field in your database you can use migrations.

    But in this case you can use virtiual attributes:

    Create two methods in your model:

    def full_name
       [first_name, last_name].joun(' ')
    end
    
    def full_name=(name)
        split = name.split(' ', 2)
        self.first_name = split.first
        self.last_name = split.last
    end  
    

    And add to your view:

    <p> Full name </p>  
    <%= f.text_field :full_name %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Rails 3.2.0 with haml and sass: I Would like to link an external
I working on Ruby on Rails application using a PostgreSQL database. I have heard
I'm building an auction-like system in Rails 3 (using PostgreSQL as the database). Imagine
Using Rails v2.1, lets say you have an action for a controller that is
I'm working on a Ruby on Rails application that used the Devise authentication system.
I'm using Rails 3.0 and PostgreSQL 8.4 on Ubuntu 10.10 and Ruby 1.9.2p136 with
I'm having trouble connecting to the database for my Rails app using pgAdmin. I
I'm using Ruby 1.9.2, Rails 3.1, Rspec, Postgres and Spork, but I can't get
I am using free Heroku plan with shared database. Cedar stack, Rails 3.1.0.rc4. When
I'm trying to run the chapter two demo_app from the Ruby on Rails 3

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.