Robert Walker wrote: [...] > I don't think it's silly at all. It's how I would approach this myself. > From the controller/model aspect this is pretty straight forward. For > each step you would add them like so: recipe.steps << new_step. > > The view is where these things get a little more tricky. There is no > "one right way" to do this. It's going to depend on your specific case. > Often it's a good idea to allow the user to add steps by using AJAX to > insert new form fields to hold all the steps the user may want to enter.
Not Ajax, just straight client-side JavaScript. There is no need to involve the server. > > Another possible approach (and one I might consider in this specific > case) would be to allow the user to enter all the instructions (steps) > into a single text area. Then using some basic markup that would allow > you to separate each step and store them individually into the steps > table. It really depends on what ends up to be the best user experience. > This is probably the approach I would take. However, for ingredients, I'd tend to use the JS approach. Also, remember that many recipes don't break down easily into discrete steps. > I would try to avoid having to refresh the entire page while adding > additional steps. That generally does not provide a great user > experience, but it is a option. It's only real advantage would be that > it would require no JavaScript to work (and so may be okay as a UI > degradation for when JS is not available). > > The down-side to the single text area approach is that you would be > relying on the end user to provide the proper delimiters that would > allow you to parse the steps properly. Right. > > I think this railscast might help you understand the basics of what you > need: > > http://railscasts.com/episodes/73-complex-forms-part-1 > > This continues in episode 74 as well. Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. -- 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.

