2013-02-14 56 views
2

我不能在''如何在Ruby中使用'?

使用'这得到语法错误:( 假设@ post.user.nickname是John

@message = @post.user.nickname + ''s post' 

它必须是John's post

如何使用'

回答

5

尝试

@message = @post.user.nickname + "'s post" 

@message = @post.user.nickname + '\'s post' 
+0

非常感谢你。 – HUSTEN 2013-02-14 07:24:12