On 16 March 2010 14:55, Jeff R. [email protected] wrote:
According to “Agile Web D. with Rails”, the field should
automagically appear on views, but that was using rails 1.2 and using
scaffold in the controller. I’m running rails 2.3.x, so wasn’t able to
use “scaffold” in the way described in the book.
Does that explain the (mis)behavior?
Which version of the book have you got?! If it’s v2 or earlier, lots
of it is going to be wrong for the version you have installed, which
is going to be very frustrating at times.
But yes - the scaffolding used to loop through all the columns :
<% for column in License.content_columns %>
<%= column.human_name %>: <%=h @license.send(column.name) %>
<% end %>
…but that’s intensely annoying because you have to totally remove
it to replace it with anything useful.
Now, the individual fields get rendered one after an other - so you
can tweak the scaffolded file, rather than re-write it completely.
(of course the down side is if you add a new field to the db, you have
to add it to the view)