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.
鉴于此代码:
has_many :foos, :finder_sql = <<-SQL select * from foos where bars = #{id} SQL
该#{id}部分被过早地插值。
#{id}
我该如何逃脱它?
在分隔符周围加上单引号:
has_many :foos, :finder_sql = <<-'SQL' select * from foos where bars = #{id} SQL