Skip to content

Instantly share code, notes, and snippets.

@d-shimizu
Last active September 21, 2018 02:57
Show Gist options
  • Save d-shimizu/6583365 to your computer and use it in GitHub Desktop.
Save d-shimizu/6583365 to your computer and use it in GitHub Desktop.
Rails4におけるController,Modleのモジュールのロード ref: http://qiita.com/d_shimizu/items/7e57e7eb62e0d96f9b0b
module Hoge
def hoge_module_method
処理内容
end
end
class TestController < ApplicationController
### モジュールの読み込み(インクルード)
include Hoge
def index
### indexメソッド内でHogeモジュールの「hoge_module_method」メソッドを呼び出す
hoge_module_method
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment