Pål Bergström wrote: > Marnen Laibow-Koser wrote: [...] >> Where do the ids that you're passing to the pagecontent helper get set? > > In the view with. > > <%= content(the_id_of_content) %> > > In the application helper: > > def content(c) > @content = Pagecontent.find(c).content > end
Then the best thing to do, it seems to me, is to restructure things as I indicated before. Moving the query into the controller will not require any more code, and it will decouple the view from the DB (which is the right thing). The proper Railsy way is like this: # controller def page1 @content = Pagecontent.find(whatever) end # page1.html.erb <%= @content %> Less code than a helper, more flexible, and more truly MVC. The helper method has nothing at all to recommend it here. 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 -~----------~----~----~----~------~----~------~--~---

