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 on Rails 的新手,我想知道,我目前将标题定义为:
<% provide(:title, @user.first_name) %>
如果我想将 @user.last_name 添加到该字符串,我该怎么做?
谢谢!
您可以使用运算符连接字符串+:
+
<% provide(:title, @user.first_name + " " + @user.last_name) %>