2

I'm completely new to rails and mostly new to web development in general. i'm trying to create a whole new tab within a page on our website. I'm trying to emulate as much as possible a tab that's already built out in our application. I noticed that there was a controller and a view associated with the tab i'm trying to emulate so I used the rails generator to create a controller for the tab (which will contain a report) i'm trying to build. So I ran generator through RubyMine (tools -> Run Rails Generator...), gave it the name i wanted to use, RejectedOffersReportController, and used show and initialize as the two actions. Incidentally, the tab i'm trying to emulate has both of those methods in the controller but only has a view for show - i'm not sure what that means exactly.

In any case, back to the matter at hand - first of all, when I go to the page where i expect the tab to be, the tab isn't there. Secondly, when I try to manually navigate (i.e. put the address in manually - localhost:3000/admin/rejected_offers_report) I get the following message in my browser:

Routing Error

uninitialized constant Admin::RejectedOffersReportsController

the bizarre part is that RejectedOffersReportsController is not anywhere to be found in my project when I do a project-wide search in the RubyMine IDE. (Notice the plural form of reports which is not the name i used in the controller generator).

Any and all help is appreciated.

UPDATE: ok, so i get why initialize isn't necessary.

1 Answer 1

2

Controllers default to the pluralized form of the class name. Just rename your controller file/class to RejectedOffersReportsController.

It's easier just to go along with the Rails conventions unless you have a good reason not to.

Sign up to request clarification or add additional context in comments.

1 Comment

changed the controller name to plural and it's starting to work. The tab is being displayed and I can click on it (though i'm getting errors in the page when I do click on it for now).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.