Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error (undefined method `empty?' for #<Encoding:UTF-8> #3

Closed
goulvench opened this issue Sep 15, 2017 · 2 comments
Closed

Error (undefined method `empty?' for #<Encoding:UTF-8> #3

goulvench opened this issue Sep 15, 2017 · 2 comments

Comments

@goulvench
Copy link

Hi,
I like the API offered by this Gem, unfortunately it doesn't work out of the box for a newly installed Rails (5.1.4) app.

I added <%= page_meta %> in the head of my application default layout, and translations for the current page title in the current locale, but got this error instead:

ActionView::Template::Error (undefined method `empty?' for #<Encoding:UTF-8>):

Any idea what causes this? I would have preferred sending a PR but I wasn't able to spot where the issue comes from.
Thanks!

@dedman
Copy link

dedman commented Sep 18, 2017

Hey @goulvench or anyone else running into this.

I just used a monkey patch as a quick and dirty workaround. This gem is used by the https://github.com/fnando/coupons gem, and as I don't really care about the meta title of the coupons page, I just monkey patched it like this. This stops the error, but I haven't checked if it still shows the meta attributes appropriately as in my situation I don't care about them.

put this in
config/initilizers/page_meta_monkey_patch.rb

#https://github.com/fnando/page_meta/issues/3
module PageMeta
  class MetaTag
    class Charset < MetaTag
      def render
        return if content.blank?

        helpers.tag(:meta, charset: content)
      end
    end
  end
end

@fnando
Copy link
Owner

fnando commented Sep 28, 2017

Closed via ae9b521..

@fnando fnando closed this as completed Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants