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.
本质上我正在尝试进行这种比较
request.fullpath == "/contacts/"+current_user.id
将字符串与变量连接以执行这样的比较的最佳方法是什么?
您可以将其插入为 request.fullpath == "/contacts/#{current_user.id}"
request.fullpath == "/contacts/#{current_user.id}"
"/contacts/#{current_user.id}"
始终使用字符串插值,它比<<和+
<<
+