How to DRY on CRUD parts of my Rails app?

Posted by kolrie on Stack Overflow See other posts from Stack Overflow or by kolrie
Published on 2009-01-25T02:56:23Z Indexed on 2010/06/12 15:12 UTC
Read the original article Hit count: 197

Filed under:
|
|
|
|

I am writing an app which - similarly to many apps out there - is 90% regular CRUD things and 10% "juice", where we need nasty business logic and more flexibility and customization.

Regarding this 90%, I was trying to stick to the DRY principle as much as I can. As long as controllers go, I have found resource_controller to really work, and I could get rid of all the controllers on that area, replacing them with a generic one.

Now I'd like to know how to get the same with the views. On this app I have an overall, application.html.erb layout and then I must have another layout layer, common for all CRUD views and finally a "core" part:

  • On index.html.erb all I need to generate a simple table with the fields and labels I indicate.

  • For new and edit, also generic form edition, indicating labels and fields (with a possibility of providing custom fields if needed).

  • I am not sure I will need show, but if I do it would be the same as new and edit.

What plugins and tools (or even articles and general pointer) would help me to get that done?

Thanks, Felipe.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about views