-1

Possible Duplicate:
String concatenation and Ruby

I would like to combine two string in rails. My database is Postgre and I want the string first_name and last_name to become one string called full_name.

How can I best achieve this? Thx

Community
  • 1
  • 1
user1884013
  • 67
  • 1
  • 5
  • 2
    Can you be a little more specific? Do you just want a `full_name` method on your model? Do you want to combine the two columns in the database and end up with just a `full_name` column instead of the `first_name` and `last_name` columns that you currently have? – mu is too short Jan 19 '13 at 19:36

1 Answers1

7
class User < ActiveRecord::Base

  def full_name
    "#{first_name} #{last_name}"
  end
end
dimuch
  • 12,728
  • 2
  • 39
  • 23