The first layer is routing and the second layer the controller, so when in View, is there a way to dump out the path or filenames and line numbers of route and controller before reaching view?
I wanted to do this because www.example.com/stories/12345 is showing a page, but stories_controller.rb doesn’t have a def index or def show
Update: I guess it might be as if the program has an error, in which case it will show an application trace and a rails trace.
Well actually there is no other alternative than using a
indexorshowand 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:
active_scaffoldthat adds all the standard CRUD actions (index, show, …)To see where a method is defined, you could type inside your
script/consolesessionand 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:Hope this helps.