Im trying to teach myself rails by creating a training log application and Im wondering what the best practice for generating activities when a certain sport is selected would be. I generated a athletes scaffold and edited the form with a select box for the sport and once you selct the sport I want the application to automatically generate activities or workouts for that given sport. I initially did this by inserting this code into the create and update methods of the controller: if @athlete.sport == "Cross Country Skiing" @athlete.activities = %w( SkateSki ClassicSki RSCL RSSK Gym) elsif @athlete.sport== "Road Biking" @athlete.activities = %w( RoadBike MountainBike Gym) end However this causes a small anomaly when I update the info the first time it sees the original sport when it calls the @athlete Athlete.new(params[:athlete]) from the database. This results in it not changing the array of activities, making me have to repeat the edit once more before it sees the new sport in the database entry. There must be a better way of doing this, is it possible to put this logic in the model before it saves/updates the object? Any suggestions? Thanks in advance! Graeme -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=.