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条)

报告相同问题?

悬赏问题

  • ¥30 这个功能用什么软件发合适?
  • ¥60 微信小程序,取消订单,偶尔订单没有改变状态
  • ¥15 用pytorch实现PPO算法
  • ¥15 关于调制信号的星座图?
  • ¥30 前端传参时,后端接收不到参数
  • ¥15 这是有什么问题吗,我检查许可证了但是显示有呢
  • ¥15 机器学习预测遇到的目标函数问题
  • ¥15 Fluent,液体进入旋转区域体积分数不连续
  • ¥15 java linux下将docx文件转pdf
  • ¥15 maven无法下载依赖包