-1

Rubyファイル内でアプリケーションコントローラーメソッドを呼び出すにはどうすればよいですか? 従来の MVC アーキテクチャを使用できません。

ありがとう!

4

3 に答える 3

0

If the method is meant to be called from both the application controller and some other ruby file, then you need to move that method to another file, probably a Plain Old Ruby Object (PORO). Then, require that file from your controller and from whatever other file needs to use it.

It's a good idea to only have controller-related logic in controllers. Since you're calling this method from something besides a controller, it must not be strictly controller-related logic, so this is the perfect opportunity to move it.

于 2015-01-12T18:37:34.713 に答える