Ruby On Rails 3 - выпуск ленты Atom - PullRequest
0 голосов
/ 13 мая 2011

Я получаю эту ошибку, связанную с БД. Есть идеи как это решить?

/ приложение / просмотров / статьи / 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 |

1 Ответ

0 голосов
/ 13 мая 2011

Если вы следуете моей статье , то именно эта строка в контроллере и ваша модель пропускает состояние атрибута: @articles = Article.where(:state => ['3', '4']).order('accepted desc')

Редактировать: просто удалите where и используйте Article.order ('...')

...