0

以下是模型。我已经在 Rails 2.3.2 上安装了 Redcloth((4.2.2) 和acts_as_textiled 插件

class Post < ActiveRecord::Base
  acts_as_textiled :content
end

现在从控制台:

[Staging]>> post = Post.new(:title => 'the post title', :content => 'the link is "linked":http://www.cc.com', :user_id => 1)
=> #<Post id: nil, title: "the post title", content: "the link is \"linked\":http://www.cc.com", user_id: 1, comments_count: 0, published_at: nil, created_at: nil, updated_at: nil>
[Staging]>> post.content
=> "<p>the link is &#8220;linked&#8221;:<a href=\"http://www.cc.com\">http://www.cc.com</a></p>"
[Staging]>> post.save
=> true
[Staging]>> post.content
=> "<p>the link is &#8220;linked&#8221;:<a href=\"http://www.cc.com\">http://www.cc.com</a></p>"
[Staging]>> post.content = '_simple_'
=> "_simple_"
[Staging]>> post.save
=> true
[Staging]>> post.content
=> "<p><em>simple</em></p>"
[Staging]>> post.content = "This is *cool*"
=> "This is *cool*"
[Staging]>> post.content
=> "<p>This is <strong>cool</strong></p>"
[Staging]>> post.textiled = false
=> false
[Staging]>> post.content = "This is *cool*"
=> "This is *cool*"
[Staging]>> post.content
=> "This is *cool*"
[Staging]>> post.textiled = true
=> true
[Staging]>> post.content
=> "<p>This is <strong>cool</strong></p>"

除了链接弄乱之外,每个纺织品代码都有效。为什么该链接没有像宣传的那样格式化?

=> "<p>the link is &#8220;linked&#8221;:<a href=\"http://www.cc.com\">http://www.cc.com</a></p>"

链接与链接本身一起保存?它出什么问题了?

4

1 回答 1

0

使用旧版本的acts_as_textiled 时,我遇到了同样的问题。确保从http://github.com/defunkt/acts_as_textiled/提供的 git 存储库中克隆最新版本

更新版本后,链接开始正常工作

于 2009-11-15T05:43:22.017 回答