【发布时间】:2021-06-08 08:33:25
【问题描述】:
我是 Rails 的新手,我想保留一个作为表单输入的值。所以这个值将在控制器和视图之外的适配器类中使用。我已阅读 cookie 和会话不是最好的方法。
# app/controller/somewhere.rb
class MyController > ApplicationController
def input_capture
form_value = "xxxxxx"
** # i need to do something with this value to access it in the adapter
# app/adapters/someadapter.rb
class MyAdapter
def self.some_method
form_value
【问题讨论】:
-
为什么不使用 ActiveRecord?
标签: ruby-on-rails