I'm trying to add Redcloth to my Gem file, and when I run 'bundle install', I get the following:
Installing RedCloth (4.2.6) with native extensions /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) /home/user/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb Gem files will remain installed in /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/RedCloth-4.2.6 for inspection. Results logged to /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/RedCloth-4.2.6/ext/redcloth_scan/gem_make.out from /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' from /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `each' from /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `build_extensions' from /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:156:in `install' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `block in run' from /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' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run' from /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' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/bin/bundle:13:in `' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/bin/bundle:19:in `load' from /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/bin/bundle:19:in `'
If I run "gem install RedCloth" and then run "bundle install", it works, however when I actually try to use RedCloth in a model 'Vendor.rb' I get:
Uninitialized constant Vendor::RedCloth
Here's my gemfile:
gem 'rails', '3.0.3' gem "compass", ">= 0.10.6" gem "haml" gem 'formtastic' gem 'devise', :git => 'git://github.com/plataformatec/devise.git', :branch => 'master' gem 'oa-oauth', :require => "omniauth/oauth" gem 'mogli' gem 'dalli' gem 'exceptional' gem 'json' gem 'RedCloth' group :test, :development do gem "ruby-debug19" gem "rspec-rails", "~> 2.4" gem 'sqlite3-ruby', :require => 'sqlite3' gem 'hpricot' gem 'ruby_parser' gem 'heroku' gem "flutie" end group :test do gem 'cucumber-rails' gem 'capybara' gem 'database_cleaner' gem 'mocha' gem 'factory_girl_rails' gem 'shoulda' gem 'ZenTest' gem 'fakeweb' end
And here's my model:
class Vendor ActiveRecord::Base has_many :reviews belongs_to :user validates_presence_of :name validates_presence_of :description before_save :convert_text def convert_text self.description = RedCloth.new(self.description).to_html unless self.description.nil? self.services_description = RedCloth.new(self.services_description).to_html unless self.services_description.nil? self.clients_description = RedCloth.new(self.clients_description).to_html unless self.clients_description.nil? self.pricing_description = RedCloth.new(self.pricing_description).to_html unless self.pricing_description.nil? self.press = RedCloth.new(self.press).to_html unless self.press.nil? end end
Thanks in advance.
This might be related to the problem I had this morning with RedCloth.
I also installed version 4.2.6 of RedCloth, and then could not use it in a Sinatra app, no matter what I did. (I got a lot of similar errors, Uninitialized constant RedCloth
.) However, the RedCloth site (http://redcloth.org/) says the latest stable version is only 4.2.2.
I uninstalled 4.2.6 and installed 4.2.2, and it worked perfectly.
Try adding the restriction to your Gemfile, ie gem 'RedCloth', '4.2.2'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.