Saturday, March 17, 2007

More on [Aa]sset(s)...

I notice that I've still got "assets_helper" and I rename that to "asset_helper" and make sure that server is rebooted.... no change. So I dig a little deeper and notice that there's still layouts/assets.rhtml and views/assets. The key seems to be the layout file because now I've got my CSS goodies back...

BUT... now "Edit" and "Create New" no longer work...argh!

A little more of changing things one at a time and I find:
  • assets.rhtml yields no CSS but working create/edit
  • asset.rhtml yields CSS but non-working create/edit (this is the one that has the <%= ajax_scaffold_includes %>
TipSheetForBeginners doesn't help as there's no discussion about singular, plural, capitalization, CamelCase, underscores for Views... but it clearly makes a huge difference.

As I look around, I begin to understand why I'm confused over this particular convention: it seems that other folks don't get it right, either. This is part of the installation instructions:

Notice that they say "users", not user...

I do some testing and find that typing in something like:
ruby script\generate controller Asset
works just fine; the caps are converted to lower case. And typing in something like:
ruby script\generate controller CamelCase
also works fine: CamelCase is converted to camel_case.

But I'm beginning to reconsider my initial positive reaction to the "convention" argument... it may be a convention, but (a) it's not as easy to use/remember as I figured it would be [although I presume I'll get more used to it as time goes on] and (b) it seems as if there may be some unintended consequences in some cases of not following the conventions. Might explain some of the inexplicable (to me) challenges with this simple app.

More fun tomorrow :-)

No comments:

Post a Comment