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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:26:50+00:00 2026-05-23T23:26:50+00:00

Its late and I probably should sleep on this. Easy one I have 3

  • 0

Its late and I probably should sleep on this. Easy one

I have 3 fields in a form which a user fills in. Once they click the create button these records are saved to the database. Simple.

However I want the data from these three fields at the same time to be concatenated together, nothing fancy..and inserted to the database at the same time as the other records. This should reflect back to the user on the show page after they create.

So I need an action to concatenate 3 db columns lets say column names are firstname, surname and DOB. table name PeopleDetails

I have tried building the model using after_create, before_save, built into the model, but nada. suggestions. I think I will come back and revisit this after some sleep

  • 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-23T23:26:50+00:00Added an answer on May 23, 2026 at 11:26 pm

    Assuming you have a column (model attribute) called full_name than you can combine all together on a model create/save via:

    class User < ActiveRecord::Base
      before_save :concatenate_details
    
      def concatenate_details
         self.full_name = "#{firstname} #{surname} #{dob}"
      end
    
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's probably late and I have missed this off by a long shot. I
This should be a no brainer, its late and i cant see what i
Ok this one is killing me. Maybe its late and I am forgetting something,
it's late, I'm tired, and probably being quite dense.... I have written an application
It's late and I have written this monstrosity of a query to get related
It's late on a Friday and I'm scratching my head on this one. I'm
Ok its late and I am not catching why this is broken. So here
maybe its late or something, but this is freaking me out. Basicly im writing
Its late so this may be a dumb question... If Fish is a class
Its late and I have been trying to work on a simple script to

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.