Created
October 28, 2016 00:22
-
-
Save kodaitakahashi/3abdff982efe864092e83444f2fba67c to your computer and use it in GitHub Desktop.
HANAMI ControllerとViewのデータの共有の仕方
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# apps/web/controllers/hoge/hoge.rb | |
module Web::Controllers::hoge | |
class Index | |
include Web::Action | |
expose :hoge #Viewと共有するインスタンス変数のシンボルを渡す | |
def call(params) | |
@hoge = 'Hello Hoge' # exposeに明示されているためViewに共有される。 | |
@huga = 'Hello Huga' # exposeに明示されていないためViewには共有されない。 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment