Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 字符串连接和 Ruby
我想在导轨中组合两个字符串。我的数据库是 Postgre,我希望字符串 first_name 和 last_name 成为一个名为 full_name 的字符串。
我怎样才能最好地做到这一点?谢谢
class User < ActiveRecord::Base def full_name "#{first_name} #{last_name}" end end