Help controller


#1

Yes, I know the irony of asking for help with a help controller. :slight_smile:

The intent here is to have a place to put common help messages,
nothing complicated at the beginning at least. I created a help
controller, but of course the rspec_scaffold generator called it, and
the path generated, ‘helps’. I tend to think /helps/… is a path
that might indicate we need a better translator, so I added this to my
routes.rb file:

map.resources :help

This seems to have taken care of most of it. Since right now all the
terms come from an internal, non-database-backed array, I have no need
(currently) for the other methods, so I added :only => [:index, :show]
to this. However, I also want an entry page which doesn’t just list
all possible status codes, I added :collection => { :all => :get } as
well.

Now, this works, but it was a lot of manual renaming of files.

The question is, what are others doing for this sort of thing? /helps
just seems so… wrong, but everything behind it would be RESTful.
/help/ won’t map into certain paradigms of automatic resource mapping,
but I like it better for the user to see on the screen.

Thanks,
–Michael


#2

Pick a name that pluralizes nicely, for example:

generate rspec_scaffold HelpScreen key:string content:text

You can also edit config/initializers/inflections.rb to specify your
singular / plural rule but understand that help / help won’t work
without the manual munching you’ve been doing.