我正在尝试将 Redcloth 添加到我的 Gem 文件中,当我运行“捆绑安装”时,我得到以下信息:
使用本机扩展安装 RedCloth (4.2.6) /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `rescue in阻止 build_extensions':错误:无法构建 gem 原生扩展。(Gem::Installer::ExtensionBuildError)
/home/user/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb
Gem 文件将继续安装在 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/RedCloth-4.2.6 以供检查。
结果记录到 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/RedCloth-4.2.6/ext/redcloth_scan/gem_make.out
来自 /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:507:in `block in build_extensions'
来自 /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `each'
来自 /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `build_extensions'
来自 /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:156:in `install'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `block in run'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `block in each'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/bin/bundle:13:in `'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/bin/bundle:19:in `load'
来自 /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/bin/bundle:19:in `'
如果我运行“gem install RedCloth”然后运行“bundle install”,它可以工作,但是当我实际尝试在模型“Vendor.rb”中使用 RedCloth 时,我得到:
未初始化的常量 Vendor::RedCloth
这是我的宝石文件:
宝石'导轨','3.0.3' 宝石“指南针”,“>= 0.10.6” 宝石“哈姆” 宝石'formtastic' gem '设计', :git => 'git://github.com/plataformatec/devise.git', :branch => 'master' gem 'oa-oauth', :require => "omniauth/oauth" 宝石“莫格利” 宝石“达利” 宝石'特殊' 宝石'json' 宝石'红布' 组 :test, :development 做 宝石“红宝石调试19” gem "rspec-rails", "~> 2.4" gem 'sqlite3-ruby', :require => 'sqlite3' 宝石“杏” 宝石'ruby_parser' 宝石'heroku' 宝石“长笛” 结尾 组:测试做 宝石'黄瓜导轨' 宝石“水豚” 宝石'database_cleaner' 宝石“摩卡” 宝石'factory_girl_rails' 宝石“应该” 宝石'ZenTest' 宝石“假网” 结尾
这是我的模型:
类供应商 ActiveRecord::Base
has_many :评论
属于_to:用户
validates_presence_of :name
validates_presence_of :描述
before_save :convert_text
def 转换文本
self.description = RedCloth.new(self.description).to_html 除非 self.description.nil?
self.services_description = RedCloth.new(self.services_description).to_html 除非 self.services_description.nil?
self.clients_description = RedCloth.new(self.clients_description).to_html 除非 self.clients_description.nil?
self.pricing_description = RedCloth.new(self.pricing_description).to_html 除非 self.pricing_description.nil?
self.press = RedCloth.new(self.press).to_html 除非 self.press.nil?
结尾
结尾
提前致谢。