I do feel scaffold is a bit broken

James, It turns out creating my own modified version of generator is not that hard: http://wiki.rubyonrails.org/rails/pages/UnderstandingGenerators

I probably would do a few code hack this weekend to come up with mine :slight_smile: Then let's see if my solution is going to help some people out from their pain :slight_smile:

Not to mention the fact that he's free to continue to use Rails 1.2.

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #3 out NOW! http://sensei.zenunit.com/

True, but the new RESTful feature is useful, thats why I am a bit greedy and hope I could have best of both worlds.

Want to let everyone know that I am almost done hacking the generator. However I hit into an issue which due to my short age with ruby I don't understand how to implement properly- the route_resources command does not allow me to do namespace. I want to add 2 methods, one to add namespace, the other one to do route_resources within a specified namespace, how should I add it to the Rails generator create command? (I bet its something like extend/include an addon module? but somehow I am a bit confused on this one still) it would be great if someone could contribute this piece of code.

Most important thing: you may get the code from google code:

http://code.google.com/p/rails-sfold-resources/

Simply use SVN to checkout and put it in your .rails home to play around it. Or you may also create a new rails project and then throw it inside lib/generators.

Guys I made an update- now it will also generate appropriate routes inside routes.rb (but the indentation need some tuning, which I will fix it later) Basically I tried to do 2-3 level namespaces nesting and they all work correctly now.

Known issues: 1. Imperfect indentation in routes.rb- will be fixed very soon 2. Ugly code: the extended route_resources_in_namespace is really some quick hack thus it has quite a bit duplications 3. Destroy does not remove namespace route, you have to do it yourself 4. Multiple scaffold elements does not reuse namespace code block, thats really difficult to fix as it has to follow the entire hierarchy to make sure the namespace is suitable to be used. Anyway I think its minor issue as all you really need to fix are just inside routes.rb.

Please let me know if you have any questions, and if you found it useful, please reply the post so I know you are using it :slight_smile: