feedreader / pluto

pluto gems - planet feed reader and (static) website generator - auto-build web pages from published web feeds
Creative Commons Zero v1.0 Universal
192 stars 14 forks source link

Building with blank template fails due to undefined method for ActiveRecord::AssociationRelation #7

Closed liquidat closed 7 years ago

liquidat commented 7 years ago

I am trying to run pluto from within CentOS with ruby 2.3 installed. However, when building using the blank template an error occurs stating that there is an undefined method for ActiveRecord::AssociationRelation:

$ pluto b ruby-news.ini -t blank
[...]
OK - fetching feed 'jruby' - HTTP status 200 OK
no change; md5 digests match; skipping parsing feed
*** warn: no site with key 'ruby-news' found; using untitled site record
Merging template pack 'blank'
  Loading template manifest /opt/app-root/src/.pluto/blank/blank.txt...
  Merging to ruby-news.html...
  Loading template (from file) >/opt/app-root/src/.pluto/blank/blank.html.erb<...
  Merging to ruby-news.cards.html...
  Loading template (from file) >/opt/app-root/src/.pluto/blank/blank.cards.html.erb<...

*** error: undefined method `in_columns' for #<ActiveRecord::AssociationRelation []>

The config file is a shortened version of your example:

$ cat ruby-news.ini 
title  = Planet Ruby News
source = https://raw.github.com/planetruby/planet/master/ruby-news.ini

[rubylang]
  title = Ruby Lang News
  link  = http://www.ruby-lang.org/en/news
  feed  = http://www.ruby-lang.org/en/feeds/news.rss

[jruby]
  title = JRuby News
  link  = http://www.jruby.org
  feed  = http://www.jruby.org/atom.xml

If I take the news template, there are no problems.

$ pluto b ruby-news.ini -t news
[...]
Done.
geraldb commented 7 years ago

@liquidat Thanks for reporting. I've updated the blank template (for ActiveRecord 5+). It requires to_a in https://github.com/planet-templates/planet-blank/blob/master/blank.cards.html.erb#L56 e.g.

site.items.latest.limit(24).to_a.in_columns(2).each do |items| 

Please, try again (should now work as advertised). Sorry for the trouble.

liquidat commented 7 years ago

Perfect, it works now. Thanks =)