- Maybe the loop is acting as though there's no data because the backend Rails is connecting to doesn't have data.
If your content is in the production database, Rails needs to be using the production database, too.
rails server -e production
See further notes on switching to the production environment in this question: Change a Rails application to production
If "contents" is nil, then accessor methods like ".posts" will show up as no method errors. Try adding a section to your template so you can handle things if "contents.nil?" is true.
Since I'm not familiar with Locomotive CMS, just Rails, here's another thing to try in situations like this: Be careful with singular and plural references to your models! Rails is very particular about these names, you might need to use "content" rather than "contents".