Michael Campbell
2006-Nov-04 02:19 UTC
[Rails] populating select boxes, view or controller?
Over the past few days I''ve seen a number of examples posted here where people are populating their select boxes in the view; that is: <% options = Model.find(:all, ...).map{|m| [m.name, m.id]} -%> <%= select(:object, :attribute, options, ... %> Is this the preferred way of doing this? I''ve generally done this in my controller, where I can catch exceptions and such, but the preponderance of this way makes me think I''m doing something out of the ordinary. Thoughts welcome. -- Quidquid latine dictum sit, altum viditur. (Anything sounds profound in Latin)