【问题标题】:html_escape seems to be broken after upgrading to Rails 3.1升级到 Rails 3.1 后 html_escape 似乎坏了
【发布时间】:2011-10-01 08:27:54
【问题描述】:

我有一个项目,它使用来自 80beans 的荷兰人的所见即所得编辑器“wysihat-engine”。它使用 Rails 版本 3.0.9 可以正常工作,但升级到 3.1.0 后,wysihat-engine 无法从 ERB::Util (ActiveSupport 3.1.0) 找到 'html_escape',给我这个错误消息:

undefined method `html_escape' for #<ActionView::Helpers::InstanceTag:my-wysihat-editor- instance>

我已经通过在 'wysihat-engine.rb' 中定义 'html_escape' 来修复它(确实很糟糕),但我敢肯定,有理由不这样做:)。

我的问题: 1.这是新版Rails的bug吗? 2. 对于 Rails 3.1 项目,WYSIWYG 编辑器有更好的选择吗?

提前谢谢你。

【问题讨论】:

    标签: ruby-on-rails activesupport html-escape


    【解决方案1】:

    wysihat-engine 似乎与 Rails 3 不兼容。

    我尝试将其安装在新的 Rails 3.1 应用程序中,但生成器在尝试生成数据库迁移时失败:

    $ rails generate wysihat

    ~/.rvm/gems/ruby-1.9.2-p290@rails31/gems/railties-3.1.0/lib/rails/generators/migration.rb:30:in `next_migration_number': NotImplementedError (NotImplementedError)
        from ~/.rvm/gems/ruby-1.9.2-p290@rails31/gems/railties-3.1.0/lib/rails/generators/migration.rb:49:in `migration_template'
        from ~/.rvm/gems/ruby-1.9.2-p290@rails31/gems/wysihat-engine-0.1.13/lib/generators/wysihat_generator.rb:60:in `install_wysihat'
    

    我很惊讶你甚至得到了你发布的html_escape 错误。解决这个问题需要对源代码进行一些修改。您可以ask the developer 获取信息。

    【讨论】:

    • 是的,这并不容易 ;) 这个错误来自 wysihat-generator.rb 中的一个遗漏的 'self',在声明受保护的 'next_migration_number(dirname)' 时,它应该被添加到像这样:def self.next_migration_number..........
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-04
    • 1970-01-01
    • 2014-12-05
    • 1970-01-01
    • 2011-11-10
    相关资源
    最近更新 更多