Well actually there is no other alternative than using a index
or show
and it has to be defined inside the class StoriesController. But it does not mean that those methods are defined inside the file "stories_controller.rb".
There are a few options:
- they are defined in the ApplicationController from which it derives. Or there is another parent-class.
- for instance, when you use ActiveScaffold your controller contains a single line
active_scaffold
that adds all the standard CRUD actions (index, show, ...)
To see where a method is defined, you could type inside your script/console
session
StoriesController.new.method('index')
and it would return a set of classes/modules, as explained here.
For instance, in our ApplicationController we include a module that defines a method login_required
, and that looks like this:
>> ApplicationController.new.method(:login_required)
=> #<Method: ApplicationController(PilgrimBase::Base::Authenticated)#login_required>
Hope this helps.