gemfile由gem 'barby'
我在控制器中编写了一个代码:
require 'barby'
require 'barby/barcode/ean_13'
require 'barby/outputter/ascii_outputter'
require 'barby/outputter/html_outputter'
def show
@card = Barby::EAN13.new(emp_code)
@card_for_html = Barby::HtmlOutputter.new(@card)
end
private
def emp_code
@emp_code = "#{@user.date_of_joining} + #{@user.full_name} + #{@user.id}"
end
在我看来,我写道:
<%@card.ascii=@card.to_ascii%> </p>
<%=raw @card_path_for_html.to_html%> </p>
产生错误undefined method 'to_ascii'
任何人都可以帮助我吗?