miceying 2010-02-01 16:05
浏览 199
已采纳

beast论坛建主题出现问题 求帮忙

ArgumentError in ForumsController#create
wrong number of arguments (2 for 0)
RAILS_ROOT: E:/Users/zhangyinghao/Desktop/beast/beast-1.0

Application Trace | Framework Trace | Full Trace
E:/Users/zhangyinghao/Desktop/beast/beast-1.0/vendor/plugins/white_list_formatted_content/init.rb:23:in initialize' E:/Users/zhangyinghao/Desktop/beast/beast-1.0/vendor/plugins/white_list_formatted_content/init.rb:23:innew' E:/Users/zhangyinghao/Desktop/beast/beast-1.0/vendor/plugins/white_list_formatted_content/init.rb:23:in body_html_with_formatting' E:/Users/zhangyinghao/Desktop/beast/beast-1.0/vendor/plugins/white_list_formatted_content/init.rb:18:informat_content'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in send'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in
evaluate_method'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in call'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:93:in
run'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in each'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in
send'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in run'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in
run_callbacks'
E:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:344:in callback'
E:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:249:in
create_or_update'
E:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2555:in save_without_validation!'
E:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:1088:in
save_without_dirty!'
-e:2:in `load'
-e:2
Request
Parameters:

{"forum"=>{"name"=>"321321321",
"description"=>"321321321",
"position"=>"321321321"},
"commit"=>"Create"}

Show session dump


Response
Headers:

{"Content-Type"=>"",
"Cache-Control"=>"no-cache"}

我的环境是ruby 1.8.6 rails 2.3.5 beast 1.0 db pg8.2 RedCloth 4.2.2

下面是插件white_list_formatted_content
ActiveRecord::Base.class_eval do
include ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, WhiteListHelper
def self.format_attribute(attr_name)
class < < self; include ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, WhiteListHelper; end
define_method(:body) { read_attribute attr_name }
define_method(:body_html) { read_attribute "#{attr_name}_html" }
define_method(:body_html=) { |value| write_attribute "#{attr_name}_html", value }
before_save :format_content
end

def dom_id
[self.class.name.downcase.pluralize.dasherize, id] * '-'
end

protected
def format_content
body.strip! if body.respond_to?(:strip!)
self.body_html = body.blank? ? '' : body_html_with_formatting
end

def body_html_with_formatting 
  body_html = auto_link body { |text| truncate(text, 50) } 
  textilized = RedCloth.new(body_html, [ :hard_breaks ]) 
  textilized.hard_breaks = true if textilized.respond_to?("hard_breaks=") 
  white_list(textilized.to_html) 
end 

end

  • 写回答

2条回答 默认 最新

  • itsouthwolf 2010-02-06 15:46
    关注

    换RedCloth3
    [code="ruby"]gem install RedCloth -v 3.0.4[/code]

    见我的BLOG
    [url]http://southwolf.iteye.com/blog/588491[/url]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 西南科技大学数字信号处理
  • ¥15 有两个非常“自以为是”烦人的问题急期待大家解决!
  • ¥30 STM32 INMP441无法读取数据
  • ¥15 R语言绘制密度图,一个密度曲线内fill不同颜色如何实现
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥15 pyqt信号槽连接写法
  • ¥500 把面具戴到人脸上,请大家贡献智慧,别用大模型回答,大模型的答案没啥用
  • ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。