我正在尝试为我的 Rails 3 应用程序安装几个不同的插件。我 cd 到 '/vendor/plugins/',然后输入git clone the_git_src_url
.
我看到 /vendor/plugins/ 目录中的文件。但是,当我尝试使用插件提供的任何标签时,我得到
uninitialized constant ContentsController::HTMLToTextileParser
PriceTag https://github.com/mattt/pricetag and html2textile https://github.com/thickpaddy/html2textile是我尝试使用的两个插件。这就是触发上述错误的原因:<%= PriceTag.html_to_textile(@content.desc) %>
我正在开发中,我尝试重新启动服务器。我有什么遗漏的吗?
html2textile
是一个 Ruby gem,而不是 Rails 插件。要安装要在 Rails 3 应用程序中使用的 gem,您可以使用构建器在 Gemfile 中添加新的 gem。
gem 'yourgem', :git=>'git://yourpath.git'
i.e.
gem 'html2textile', :git=>'git://github.com/thickpaddy/html2textile.git'
这会说你的应用程序needs那个宝石可以工作;跑步bundle install
将检查您的应用程序所需的所有 gem 是否已安装,并将安装缺少的 gem。
如果您喜欢体力劳动并且您感兴趣的宝石无法通过通常的方式获得gem install yourgem
,您可以从存储库中检查源代码并自行构建 gem 来安装它。
建造html2textile
:
$ git clone https://github.com/thickpaddy/html2textile.git
$ cd html2textile/
$ gem build html2textile.gemspec
$ gem install html2textile-1.0.0.jgp.gem
$ gem list | grep html2
html2textile (1.0.0.jgp)
现在你可以要求html2textile
在 Rails 应用程序或纯 Ruby 脚本中。
$ irb
> require 'rubygems'
=> true
> require 'html2textile'
=> true
pricetag
可以用同样的方法处理。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)