开发者

using Rails I18n in class

开发者 https://www.devze.com 2023-03-09 14:17 出处:网络
I have a class that generates PDF with Prawn: class CustomersReport < Prawn::Document def to_pdf text \"Hello, world\"

I have a class that generates PDF with Prawn:

class CustomersReport < Prawn::Document
  def to_pdf
    text "Hello, world"
    render
  end
end

How to use Rails I18n in this class? If I try to use translation() function, it prints u开发者_StackOverflow社区ndefined methodtranslation' for CustomersReport:Class`

I tried to add include ActionView::Helpers::TranslationHelperto my class, but no effect.


Use I18n.t(...) or I18n.translate(...).

0

精彩评论

暂无评论...
验证码 换一张
取 消