how to pass session variable to model in RoR?

前端 未结 4 1180
时光取名叫无心
时光取名叫无心 2021-01-13 07:06

I used a global variable in my app for passing information before. But I got a problem and thanks everyone here suggested me to store those data in session with database.

4条回答
  •  自闭症患者
    2021-01-13 07:28

    Models are an interface to the database. They can be used without a session (e.g. from IRB). It would be a violation of MVC to allow the models to talk to the session. Can you expand your question with a bit more info about what you're trying to do? There is most probably a better way to do it.

提交回复
热议问题