【发布时间】:2016-07-23 15:26:04
【问题描述】:
我想制作一个包含视图助手的 gem。我看这个tutorial, 但我遇到了一些问题。
如果您需要更多信息,这里是github。
助手只会打印Hello world!。
app/helpers/google_code.rb
module GoogleCode
def self.put_code
content_tag(:p, "Hello world!")
end
end
lib/google_prettify_rails.rb 需要“google_prettify_rails/version”
module GooglePrettifyRails
class Engine < ::Rails::Engine
end
end
然后,我创建了另一个项目并安装了它,并在视图中输入<%= put_code %>。但是,它抛出了这个错误
Couldn't find GooglePrettifyRailsHelper, expected it to be defined in helpers/google_prettify_rails_helper.rb
【问题讨论】:
标签: ruby-on-rails rubygems rails-engines