kpblc
kpblc

Reputation: 902

Kaminari generates string instead of html in production

I'm using Rails 4.2.1, Kaminari 0.16.3 and slim as my template language.

In development mode everything is okay. The pagination navigation is generated correctly, but when I run server in production mode, = paginate @articles generates a string instead of html. So it's escape tags and show them like regular text

<span class="page current">1</span><span class="page"><a rel="next" href="/airsoft-blog/airsoft-gadgets-and-ammunition-reviews?page=2">2</a></span><span class="next"><a rel="next" href="/airsoft-blog/airsoft-gadgets-and-ammunition-reviews?page=2">старее</a></span>

It's running on a thin server and Ruby 2.2.1. This happens the first time.

Upvotes: 1

Views: 369

Answers (2)

kpblc
kpblc

Reputation: 902

my problem was with config/locales/ru.yml

bad(not working):

 pagination:
  previous: "<span class='glyphicon glyphicon-arrow-left'></span>"

good(work correctly):

 pagination:
  previous: 'older post'

this is not kaminari bug, but only my fault. also now i think it's a bad practice if you add html inside localisation files

Upvotes: 0

Yury Lebedev
Yury Lebedev

Reputation: 4015

Try this (double equal sign):

== paginate @articles

Kaminari generates html, and it should be used as html in the template, not as string, therefor you need either raw or a == to output it.

Upvotes: 3

Related Questions