Rails: Set a common or global instance variable across several controller actions

前端 未结 4 1186
萌比男神i
萌比男神i 2020-12-14 03:02

How should one have several different controller\' actions set a common instance variable for use in templates but after the action runs.

4条回答
  •  醉话见心
    2020-12-14 03:19

    Use <%= do_some_calculations(@foo) %> inside your templates. That is the straight way.

提交回复
热议问题