开发者

Undefined method `html_safe?' error when using rails-ckeditor with formtastic

I'm trying to get the rails-ckeditor gem to work. I followed the instructions on the README. But I get this error

undefined method `html_safe?' for #<String:0xb6b6d080>

This is my formtastic form code:

<%= f.input :content, :as => :ckeditor %>

Any ideas? Thanks!

UPDATE I'm using Rails 2.3.8. And here's the stack trace.

  /usr/lib/ruby/gems/1.8/gems/ckeditor-3.4.3/lib/ckeditor/safe_buffer.rb:6:in `<<'
  /usr/lib/ruby/gems/1.8/gems/ckeditor-3.4.3/lib/ckeditor/view_helper.rb:52:in `ckeditor_textarea'
  /usr/lib/ruby/gems/1.8/gems/ckeditor-3.4.3/lib/ckeditor/formtastic.rb:9:in `send'
  /usr/lib/ruby/gems/1.8/gems/ckeditor-3.4.3/lib/ckeditor/formtastic.rb:9:in `ckeditor_input'
  /usr/lib/ruby/gems/1.8/gems/formtastic-1.1.0/lib/formtastic.rb:1281:in `send'
  /usr/lib/ruby/gems/1.8/gems/formtastic-1.1.0/lib/formtastic.rb:1281:in `inline_input_for'
  /usr/lib/ruby/gems/1.8/gems/formtastic-1.1.0/lib/formtastic.rb:109:in `send'
  /usr/lib/ruby/gems/1.8/gems/formtastic-1.1.0/lib/formtastic.rb:109:in `input'
  /usr/lib/ruby/gems/1.8/gems/formtastic-1.1.0/lib/formtastic.rb:108:in `map开发者_StackOverflow社区'
  /usr/lib/ruby/gems/1.8/gems/formtastic-1.1.0/lib/formtastic.rb:108:in `input'
  /home/shreyas/repos/citymgmt/app/views/articles/_form.html.erb:4
  /home/shreyas/repos/citymgmt/app/views/articles/_form.html.erb:2:in `_run_erb_app47views47articles47_form46html46erb_locals_form_object'
  /home/shreyas/repos/citymgmt/app/views/articles/_form.html.erb:1:in `_run_erb_app47views47articles47_form46html46erb_locals_form_object'
  /home/shreyas/repos/citymgmt/app/views/articles/new.html.erb:10
  /home/shreyas/repos/citymgmt/app/views/articles/new.html.erb:3:in `_run_erb_app47views47articles47new46html46erb'


Are you running an earlier version of Rails than 3.0.0? You'll want to install the rails_xss plugin which provides this functionality. In Rails 3, this comes standard.

I would advise, if at all possible, to upgrade to Rails 3 as soon as you are able.


Do you have a stack trace? Based on the error, I'm assuming that the plugin load order is causing a string to not be instantiated with SafeBuffer support (which also leads me to believe you're using Rails 2).

Can you provide some context?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜