Ruby On Rails 3 - Atom Feed Issue



我收到与数据库有关的错误。有什么想法如何解决吗?

/

app/views/articles/feed.atom.builder:

atom_feed :language => 'en-gb' do |feed|
  feed.title "My Blog"
  feed.updated @articles.first.accepted
  @articles.each do |article|
    feed.entry article, :published => article.accepted do | entry |
      entry.title article.title
      entry.summary article.teaser + '<br /><br />Read the full article: <a href="' + article_url(article) + '">' + article_url(article) + '</a><br /><br />', :type => 'html'
      entry.author do |author|
        author.name article.user.fullname
      end
    end
  end
end

错误:

/app/views/articles/feed.atom.builder where line #5 raised:
SQLite3::SQLException: no such column: articles.state: SELECT "articles".* FROM "articles" WHERE "articles"."state" IN ('3', '4') ORDER BY accepted desc LIMIT 1
Extracted source (around line #5):
    2: 
    3: atom_feed :language => 'en-gb' do |feed|
    4:   feed.title "My Blog"
    5:   feed.updated @articles.first.accepted
    6:               
    7:   @articles.each do |article|
    8:     feed.entry article, :published => article.accepted do | entry |

如果您正在关注我的文章,那么控制器中的这一行,并且您的模型缺少属性状态:@articles = Article.where(:state => ['3', '4']).order('accepted desc')

编辑:只需删除位置并使用Article.order('...')

相关内容

  • 没有找到相关文章

最新更新