Skip to content

Instantly share code, notes, and snippets.

@kodaitakahashi
Created October 28, 2016 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kodaitakahashi/3abdff982efe864092e83444f2fba67c to your computer and use it in GitHub Desktop.
Save kodaitakahashi/3abdff982efe864092e83444f2fba67c to your computer and use it in GitHub Desktop.
HANAMI ControllerとViewのデータの共有の仕方
# 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