Want to know how brain-dead the scaffolding generator for Rails is? Mind-bogglingly so.
The first of the two files below is what was generated for app/views/contributions/index.html.haml
; the second is the corrected version. Bear in mind that the routing had already been adjusted prior to running the generator so that it could have determined that Contribution
s were nested within Article
s, if it had cared to. The generator either didn't look or couldn't deal with nested resources. Either way, serious brain death taking significant time to detect, diagnose and work around was required.
There has to be a better way. Any ideas?
EDIT: Investigating amatsuda/nested_scaffold
as more likely to be Useful.nested_scaffold
is currently at an 0.2.3 release. Being pre-1.0 (as are many of the Gems we rely on, but that's another rant entirely), it can't be expected to yet be feature-complete, let alone bug-free. Support for RSpec is listed as a known issue. One of the major items on my "after we get staffed" to-do list is going through and systematically evaluating all pre-1.0 Gems we rely on. If there are more mature alternatives, let's see what the pros and cons of moving are. If there aren't, what outstanding issues blocking 1.0 are pain points for us? (Maybe a more fully-staffed Meldd.com could help out and get some community cred in the process.) But also, as we see here, post-1.0 status is not a universal indicator of ideal fit to our needs; RSpec itself currently sits at 2.13.something and Rails itself is at 3.12.something -- both more than mature enough for most shops to rely on.