Rails3.1引擎:无法使SLIM或HAML在测试/虚拟应用程序中工作 [英] Rails3.1 engine: can't get SLIM or HAML to work in test/dummy app

查看:87
本文介绍了Rails3.1引擎:无法使SLIM或HAML在测试/虚拟应用程序中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Rails 3.1引擎,并且要对其进行集成测试,我想使用SLIM而不是普通的ERB.所以我试图简单地将s.add_development_dependency "slim"添加到我的.gemspec文件中,但是将我的index.html.erb文件重命名为index.html.slim时,Rails抱怨道:

I'm developing a Rails 3.1 engine, and to integration test it I want to use SLIM instead of plain ol' ERB. So I tried to simply add s.add_development_dependency "slim" to my .gemspec file, but when renaming my index.html.erb file to index.html.slim, Rails complains:

缺少模板哑元/索引,带有{:locale => [:en] 、: formats => [:html] 、: handlers => [:erb,:builder]}的应用程序/索引.在以下位置搜索:*"/用户/josh/Documents/Work/Sientia/iq_menu/full/spec/dummy/app/views" *"/用户/josh/Documents/Work/Sientia/iq_menu/full/app/views"

Missing template dummy/index, application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder]}. Searched in: * "/Users/josh/Documents/Work/Sientia/iq_menu/full/spec/dummy/app/views" * "/Users/josh/Documents/Work/Sientia/iq_menu/full/app/views"

我也使用slim-rails gem和haml-rails gem尝试了此操作,但是将文件重命名为index.html.haml会导致相同的错误.

I tried it also with the slim-rails gem and also with the haml-rails gem, but there renaming the file to index.html.haml resulted in the same error.

我在做什么错了?

推荐答案

对于Haml,您必须放置

For Haml you have to put

gem 'haml-rails'

进入您的Gemfile

into your Gemfile

这篇关于Rails3.1引擎:无法使SLIM或HAML在测试/虚拟应用程序中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆