This project is archived and is in readonly mode.

#3888 ✓wontfix
javier ramirez

scaffold generator upgraded to use responder and i18n

Reported by javier ramirez | February 7th, 2010 @ 09:26 PM | in 3.0.2

I have changed the scaffold generator template to use the new responder syntax

I have also changed the generator templates to use i18n and created translations both for English and Spanish

Comments and changes to this ticket

  • Raul Murciano
  • Paco Guzmán
  • Manu Campos
  • Mikel Lindsaar

    Mikel Lindsaar February 8th, 2010 @ 10:19 AM

    • Milestone cleared.
    • State changed from “new” to “wontfix”
    • Assigned user set to “Mikel Lindsaar”

    The reason why we have not used respond_with in the scaffolds, is that it hides too much of the implementation. The target of a scaffold is a new user, not the experienced developer who knows what is going on.

    Having this much syntax sugar going on will just overwhelm a brand new user who is trying to work out how a html page gets rendered with the scaffold.

    While the patch is good, and does what it says, I believe we will not be applying this to Rails at the moment.


  • Mikel Lindsaar
  • José Valim

    José Valim February 8th, 2010 @ 10:33 AM

    If you want to use respond_with on scaffold, you can get this plug and play by installing the responders gem:

    gem install responders

    Besides, if you want to customize your scaffolds, it's quite easy. Let's suppose you are using ERB and wants to customize the show.html.erb page. You just need to copy this file:



    And do your changes. The scaffold generator will pick this file the next time. This allows you to customize scaffold they way you want and per application, without overwhelming new users.

  • javier ramirez

    javier ramirez February 8th, 2010 @ 10:45 AM

    First I want to apologize for missing ticket 3044. I searched lighthouse for "scaffold" but I somehow missed that one. Guess I was looking only for open tickets.

    My point for upgrading the generator was exactly the same as yours. Since it is going to be a tool for newbies, I wanted to make it as idiomatic as possible, using all the capabilities rails provides. If we hide the preferred/easiest method, then it's likely a new user will get used to the not-so-good way.

    I guess that's why scaffolds were changed in rails 2 to support both rest and the respond_to syntax. Should the core team have applied the same criteria back then, we would still have non-restful, non-formatted scaffolds.

    Another thing I was missing was the i18n capabilities. For a new user, it should be easier to grasp i18n if the scaffolds support it.

    Also, by having scaffolds implement the latest capabilities, I think they serve both to new and experienced users. I myself use the resource/scaffolds generators many times as a shortcut for all the boilerplate code when creating a new application. If I have i18n and responders in place, I will be saving a lot of time.

    Maybe by adding a comment at the beginning of the generated code (by the respond_to line) and then another one by the "respond_with" lines we could make it clearer for the new users, but still using an upgraded implementation.

    Thanks :)

  • Rafa G.
  • Ryan Bigg

    Ryan Bigg October 9th, 2010 @ 09:49 PM

    • Tag cleared.

    Automatic cleanup of spam.

  • Jeremy Kemper

    Jeremy Kemper October 15th, 2010 @ 11:01 PM

    • Milestone set to 3.0.2
  • bingbing

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>