`
wtb
  • 浏览: 103602 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

罗列网上的实现方法--rails中使用FCKeditor

阅读更多
1、安装rails的FCKeditor插件 script/plugin install 
   svn://rubyforge.org/var/svn/fckeditorp/trunk/fckeditor
如果出现下面的错误:
A    D:\open_rails\mephisto\trunk\vendor\plugins\fckeditor\public\javascripts\fckeditor\htaccess.txt
Exported revision 41.
Plugin not found: ["svn://rubyforge.org/var/svn/fckeditorp/trunk/fckeditor"]
那么你要使用下面命令来完成安装:
wget http://cnruby.googlecode.com/svn/trunk/rails-projects/fckeditor_use/public/javascripts/fckcustom.js
mv fckcustom.js public/javascripts/.
svn co http://cnruby.googlecode.com/svn/trunk/rails-projects/fckeditor_use/public/javascripts/fckeditor/ public/javascripts/fckeditor


或者,直接去rubyforge.org下载安装包,到vender/plugin中,用rake   fckeditor:install安装

2、使用:
   <!---->
1)非AJAX方式:非常简单,首先你需要从你的action传来一个对象,如果没有你就会一直收到一个nil错误。假设为@task=Task.new,artical有一个content字段用来存储文章内容
然后在页面调用:
<!---->

0.4.1以下版本中有个小bug,在上传图片时的bug.请用附件覆盖原来的controller

 bug: gif图片(jpeg也有可能)很小时,controller中的check_file方法中得到的file.class为StringIO类型。默认配置会导致上传失败,修改成即可(原因尚不明):

ruby 代码
  1. def check_file(file)       
  2.       # check that the file is a tempfile object   
  3.           unless "#{file.class}" == "Tempfile" or "#{file.class}"=="StringIO"  
  4.             @errorNumber = 403   
  5.             throw Exception.new  
  6.           end  
  7.       file   
  8.     end  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics