我在我的 Rails 3.1 应用程序中使用Coffeescript 模板,所以在我的 app/assets/javascripts/post.js.coffee 文件中,我有类似的内容:
$('#post').html JST['templates/posts/show'] post: post
其中 post 是一个 JSON 对象。模板位于 app/assets/javascripts/templates/posts/show
现在我也在使用 jquery_ujs 来响应 PostsController#create 并希望使用 app/views/posts/show.js.erb 来呈现响应。在 show.js.erb 中,我想使用上面的模板。我该怎么做呢?谢谢。