# [Rails4][controller][note]controller筆記 ###### tags: `Rails4`,`controller`,`note` ### 定義全域方法 參考資料: https://stackoverflow.com/questions/5985761/how-to-call-applicationcontroller-methods-from-applicationhelper * 在application_controller內定義的methods可以在所有controller中被呼叫 * 若額外使用helper_method,可以讓view也能呼叫application_controller內的methods 範例: ```ruby class ApplicationController < ActionController::Base helper_method :foo def foo "bar" end end ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up