2011-05-13 13 views
0

このエラーはdbと関係があります。任意のアイデアをどのように解決するには?Ruby On Rails 3 - Atomフィードの問題

/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 | 

答えて

0

あなたがmy articleを以下している場合、それはコントローラで、このラインであり、あなたのモデルは属性状態を逃しています:@articles = Article.where(:state => ['3', '4']).order('accepted desc')

編集:場所を削除してArticle.order( '...')を使用してください

+0

良い推測、あなたの記事に続いていた!私はこれを試しましたが、まだ動作していません@ Article @ order( 'accepted desc')。これはあなたが意味することですか? – ubique

+0

モデルにdatetime型の受け入れられた名前のフィールドがある場合、はい。それ以外の場合は、created_atを実行します。この場合、atom_feedも変更する必要があります。受け入れはそこで使用されます。 ページの上部にある基本的な例から始めて、作業後にこの例をカスタマイズする方が簡単かもしれません... –

+0

申し訳ありませんが、あなたは私をそこに失ってしまいました...? – ubique