在rails中,asp.net的App_Code文件夹相当于什么?

时间:2022-12-23 08:10:07

In rails, what is the equivalent of asp.net's App_Code folder?

在rails中,asp.net的App_Code文件夹相当于什么?

Eg, where do you put your various utility classes for your complicated business logic that you don't want to shove in your controllers or helpers?

例如,您将各种实用程序类放在哪些复杂的业务逻辑中,而不想将其放在控制器或帮助程序中?

2 个解决方案

#1


2  

That would be the lib directory.

这将是lib目录。

#2


1  

To be clear, complicated business logic goes into your model. Stick with the convention of thick models, skinny controllers.

要清楚,复杂的业务逻辑会进入您的模型。坚持厚模型,瘦身控制器的惯例。

If you have view related helper methods these go into your helpers. Other miscellaneous stuff can be put in your lib directory as @Jakub said.

如果您有与视图相关的帮助方法,则这些方法会进入您的帮助程序。其他杂项可以放在你的lib目录中,就像@Jakub所说的那样。

#1


2  

That would be the lib directory.

这将是lib目录。

#2


1  

To be clear, complicated business logic goes into your model. Stick with the convention of thick models, skinny controllers.

要清楚,复杂的业务逻辑会进入您的模型。坚持厚模型,瘦身控制器的惯例。

If you have view related helper methods these go into your helpers. Other miscellaneous stuff can be put in your lib directory as @Jakub said.

如果您有与视图相关的帮助方法,则这些方法会进入您的帮助程序。其他杂项可以放在你的lib目录中,就像@Jakub所说的那样。