Hi, Have a look at partials. That's where you can call the same snippet of render code from several views. Also, best practice seems to indicate you should put the find in the controller, not in the view.
Cheers Simon On Sun, 23 Aug 2009 04:10:45 +0800, [email protected] <[email protected]> wrote: > > I am very new to RoR (this is my second day). I have started my first > application, and want to follow best practices as much as possible. I > created a select box that lists all the items in a table column on a > new.html.erb page. I then realized I needed to create one on the edit > page. I want to use this select box on several other pages as well. > > Trying to keep with D.R.Y. I am wondering if there is a better way to > do this, instead of putting this statement on every page. > > <%= select("note", "project_id", Project.find(:all).collect {|p| > [p.name, p.id]}) %> > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

