[英]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')
屬性狀態: @articles = Article.where(:state => ['3', '4']).order('accepted desc')
編輯:只需刪除位置並使用Article.order('...')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.