开发者

In the model, is there a way to get the results of a controller request?

开发者 https://www.devze.com 2023-03-12 12:39 出处:网络
In a model Feed. is there a way to get the results of a controller call. class Feed < ActiveRecord::Base

In a model Feed. is there a way to get the results of a controller call.

   class Feed < ActiveRecord::Base
      output = Con开发者_StackOverflowtrollerName.Action(params)

Is something like that possible?


You can't (well if you really want to you can, but you shouldnt). Your controller should call a method from your model instead. Another alternative is to create a module and use it as a mixin in both classes.

0

精彩评论

暂无评论...
验证码 换一张
取 消