2016-07-23 3 views
0

私はビューヘルパーを含む宝石を作りたいと思う。私はこれを見るtutorial、 しかし、私はいくつかの問題に遭遇する。Railsはエンジンを使って宝石を作る

さらに詳しい情報が必要な場合はgithubです。

ヘルパーは、Hello world!のみを印刷します。 google_prettify_rails.rb/

アプリ/ヘルパー/ google_code.rb

module GoogleCode 
    def self.put_code 
     content_tag(:p, "Hello world!") 
    end 
end 

libに はその後 "google_prettify_rails /バージョン"

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 

答えて

2

ヘルパーの名前とヘルパーのファイル名が一致しません。 app/helpers/google_prettify_rails_helper.rbの最初の行をGooglePrettifyRailsHelperに変更してください。

+0

ありがとう、本当に便利です。 –

関連する問題