首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > Ruby Rails >

论坛beast的有关问题 求达达帮助

2012-03-09 
论坛beast的问题 求达达帮助ArgumentError in ForumsController#createwrong number of arguments (2 for

论坛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: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'
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



------解决方案--------------------


ArgumentError in ForumsController#create
wrong number of arguments (2 for 0) 
说你这个控制器ForumsController的这个action create参数错误!
你调用的方法接受两个参数,而你一个也没传!

热点排行