2009/12/10 SMR <[email protected]>: > Many Thanks, Andrew. > > The drop down is actually simpler than you indicated - it is all > string text that was validated on input. All I need to do is "select * > from valid_values where dropdown_to_be_populated = 'status' " and > populate the returned array of strings into the dropdown. > > My confusion - where would I put the code to pull this information to > make it available to the 'Tasks' view - and in that view, how can I > tell the view to look at a table that is not 'Tasks', or if I pull the > array in a controller (Tasks controller?) how to pass that to the > view?
You can have a class method of ValidValues model (if that is what it is called) named something like strings_for_selection which returns the data for the dropdown box. Then in the view simply call ValidValues.strings_for_selection. This keeps all the knowledge of which strings are valid in the model. Alternatively call the method in the controller so @strings_for_selection = ValidValues.strings_for_selection and then use this in the view. Not so good in my opinion as why should the controller be bothered with this? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

