开发者

Specifying a different model than the controller name suggests

开发者 https://www.devze.com 2023-01-15 12:07 出处:网络
I\'ve got a controller called \"ResourcesController\", but its really managing the CRUD for two different models.

I've got a controller called "ResourcesController", but its really managing the CRUD for two different models.

I don't actually have a model called Resource, so the controller is balking that it can't find it.

Is there a way I can inform the controller which model I'll be working with so it doesn't freak out?

The error that is posted is this:

NameError in ResourcesController#new

uninitialized constant Resource

Here is the controller at the moment:

clas开发者_StackOverflow社区s ResourcesController < ApplicationController

 def new
 end

end
0

精彩评论

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