为什么不使用rabl作为json响应的模板引擎?

时间:2023-01-22 20:39:57

i'm still not that familiar with rails so this could be a simple thing i've neglected to do. i have rabl installed and working on a dev server, i've just tried it on a prod server and it's not working. the environments are identical on each machine.

我仍然不熟悉rails,所以这可能是我忽略的一件简单的事情。我已经安装了rabl并在开发服务器上工作,我刚刚在prod服务器上试过它并且它无法正常工作。每台机器上的环境都相同。

rails 2.3.14, rabl 0.7.6

rails 2.3.14,rabl 0.7.6

the error i'm seeing is ActionView::MissingTemplate (Missing template asset_links/index.erb in view path app/views):

我看到的错误是ActionView :: MissingTemplate(在视图路径app / views中缺少模板asset_links / index.erb):

in my controller i've got require 'rabl' , in the console ::Rabl is defined. in the index action of the controller i'm calling render

在我的控制器中,我需要'rabl',在控制台:: Rabl定义。在我正在调用渲染的控制器的索引操作中

  :rabl => @asset_links

since the template rails is looking for is index.erb and not index.rabl, that leads me to believe Rabl is not registered somehow?

因为模板rails正在寻找的是index.erb而不是index.rabl,这让我相信Rabl没有以某种方式注册?

i installed rabl many months ago on my dev server and don't remember any extra steps required to make it render json. any ideas on what's wrong?

我在几个月前在我的开发服务器上安装了rabl,并且不记得任何使它渲染json所需的额外步骤。关于什么是错的任何想法?

1 个解决方案

#1


1  

Your production server probably hasn't picked up the rabl gem. Make sure that rabl is installed on your server and make sure your server has been restarted. If you are using unicorn with rvm then unicorn may well not be picking up the gemset you are expecting it to

你的生产服务器可能还没有拿起rabl gem。确保服务器上已安装rabl并确保已重新启动服务器。如果你使用独角兽与rvm,那么独角兽可能不会拿起你期望它的宝石

#1


1  

Your production server probably hasn't picked up the rabl gem. Make sure that rabl is installed on your server and make sure your server has been restarted. If you are using unicorn with rvm then unicorn may well not be picking up the gemset you are expecting it to

你的生产服务器可能还没有拿起rabl gem。确保服务器上已安装rabl并确保已重新启动服务器。如果你使用独角兽与rvm,那么独角兽可能不会拿起你期望它的宝石