开发者

Rails controller doesn't recognize model

开发者 https://www.devze.com 2023-03-16 08:18 出处:网络
I am trying to build a very simple rails application. When user submits a form I process some files on the server and display the results.

I am trying to build a very simple rails application.

When user submits a form I process some files on the server and display the results.

Clearly, I do not need a database for this. Howev开发者_Go百科er, I created a model so that I can put all my processing logic in it.

In in the controller, I call the process function in the model. for example

# action in controller
def my_action
  MyModel.process(params)
end

However, when I run the server and submit the form, rails says MyModel is uninitialized

uninitialized constant MyController::MyModel

What am I doing wrong?


Where do you define MyModel? Is it in app/models/my_model.rb as Rails (to put it simply) expects it to be?

0

精彩评论

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