Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 在HAML视图中包含字体图标_Ruby On Rails_Haml_Font Awesome - Fatal编程技术网

Ruby on rails 在HAML视图中包含字体图标

Ruby on rails 在HAML视图中包含字体图标,ruby-on-rails,haml,font-awesome,Ruby On Rails,Haml,Font Awesome,我试图在搜索栏的占位符中包含一个字体很棒的搜索图标,但我无法找到解决方案,也无法自己解决 到目前为止,我的代码如下所示: .container.search-customer-container %input {class: 'form-control customer-search-bar fa fa-search', placeholder: "What are you looking for?"} %i.fa-search 我的gem文件:gem'font-awesome-sass

我试图在搜索栏的占位符中包含一个字体很棒的搜索图标,但我无法找到解决方案,也无法自己解决

到目前为止,我的代码如下所示:

.container.search-customer-container

%input {class: 'form-control customer-search-bar fa fa-search', placeholder: "What are you looking for?"}
  %i.fa-search
我的gem文件:gem'font-awesome-sass',“~>4.5”

我尝试了一些不同的事情,但我对哈姆尔是新手,有点挣扎

感谢您事先提供的帮助。

使用“gem”。安装起来很容易

gemfile中:
gem“font-awesomerails”

application.css中

/*
 *= require font-awesome
 */

你可以走了

你的日志信息是什么?嘿,谢谢你的回复。实际上,我并没有同意你的答案,我找到了一种方法,用.erb写出来,通过.haml翻译程序运行,然后用css从中计算出来。我不允许再添加任何宝石,但谢谢你的帮助。