Rails 疑难解决

阅读更多
1.错误: InvalidAuthenticityToken error:

解决方案:http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html



2. 在community_engine开发过程中,若想自定义或修改里面的代码,但又不想每次重启server查看更新的结果,

在development环境下的解决方法:

Want Rails to reload the CE code on every request while in development mode? Add this to your development.rb:
config.after_initialize do
  Dependencies.load_once_paths = Dependencies.load_once_paths.select {|path| (path =~ /(community_engine)/).nil? } 

end

3.    RedCloth is not a class (TypeError)

RedCloth 之前用的 3.0.4,后来装了 4.0.1,4.x 的 main class 不再是 RedCloth,而改成了 RedCloth::TextileDoc.

在environment.rb可以指定版本来引入 gem:

    require ‘rubygems’
    gem ‘RedCloth’, ‘3.0.4′

或者出现RedCloth的地方换成RedCloth::TextileDoc(一般在environment.rb里)

参考:http://www.surui.net/2008/08/12/ruby-gems-compatible-issue/


注:development.rb在RAILS_ROOT的config/environments下

你可能感兴趣的:(Rails,rubygems,Ruby,.net,HTML)