How to use rails3 with RedCloth. require 'RedCloth' not working

烂漫一生 提交于 2020-01-05 04:14:09

问题


I have installed RedCloth, by using the devkit. Using gem install RedCloth.

If I use plain irb, then require 'RedCloth' works fine.

But if I use rails console and do require 'RedCloth', it says it can't find file to load.

Please help.

Rails 3.0.0 RedCloth 4.2.3


回答1:


Is RedClotch included in your Gemfile, and have you run bundle install since updating your Gemfile?

I don't believe Rails 3 will allow you to include gems that are not in the Gemfile. I'm not quite sure about the inner workings of bundler, but I believe the Rails app considers your Gemfile it's "only source" for loading gems.




回答2:


Make sure to do the following on Windows XP and above!

  1. Installed Ruby via rubyinstaller.org
  2. Downloaded DevKit from rubyinstaller.org
  3. From the Ruby enhanced CMD prompt, "ruby dk.rb init", followed by "ruby dk.rb install"
  4. Downloaded the SQLLite DLL files from here: sqlite.org, copied them into the C:\Windows directory
  5. From the Ruby enhanced CMD prompt, "Gem install RedCloth"
  6. Added "Gem RedCloth" to gemfile
  7. "bundle install"

These steps worked for me! I don't understand why people have such a hard time with Ruby on Windows. That's all I develop on and it works fine.



来源:https://stackoverflow.com/questions/3939411/how-to-use-rails3-with-redcloth-require-redcloth-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!