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:in
new' 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:in
format_content'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in send'
evaluate_method'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in call'
run'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:93:in
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in each'
send'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in run'
run_callbacks'
E:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in
E:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:344:in callback'
create_or_update'
E:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:249:in
E:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2555:in save_without_validation!'
save_without_dirty!'
E:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:1088:in
-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