Pål Bergström wrote:
> Marnen Laibow-Koser wrote:
> 
>> 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.
>> 
> 
> I don't see how that would mean less code.

With the helper, you have both the helper method definition and the call 
in the view.  With the proper Railsy way, you just have the call in the 
controller (equivalent to the helper definition) and the variable is 
already set for the view without further work.

But don't take my word for it.  Branch your project and try it!

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to