There are a few core practices you can follow with view templates and 
attempting a DRY concept.

Partials are fine if you have a lot of repeating HTML in many of your 
views because you can use a partial for table structures etc.  As an 
example, if you are creating a large table and that table needs to be 
used in several views within the same controller, you can use a partial 
for the other views.

However, when working with actual code, I like to work with helpers. 
The best practice is not to include too much code functionality in your 
views but move those to a helper if you find yourself needing the same 
one over and over.

You should follow these basic things:

Views are meant for html and all things that represent the display your 
users see.  Your controllers are the director that talks to your models 
and to your views.  When you need a database call, the controller talks 
to the model and the model retrieves the data and hands it back to the 
controller, who then hands it back to the view.

Don't make the mistake of trying to skip the MVC architecture in your 
project.  If you form bad habits they are hard to break.

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