罗列网上的实现方法--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  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值