The web designer is wrong in thinking that because you have separate 
edit and new views files that most of the page is different and not 
sharing a greate deal of code. They are ignoring the fact that most 
template view are views within views. Especially if you are using a 
partial - where you have a template within a template within a template.

The outer template is the layout. Into this is inserted the view. And 
into this is inserted the form partial. In effect you have:

layout | view | partial | view | layout

Where the partial is within the view which is within the layout. A 
classic onion skin type arrangement. With your two views what you 
effectively have are:

layout | edit | form | edit | layout

and

layout | new | form | new | layout

So by choosing a different view you are doing one big if. That is if 
view is 'edit' slot the 'edit' template in the middle layer, or if the 
view is 'new' slot the 'new' template into the middle layer.

What's more this is far neater than using lots of if statements with a 
single template. You've separated the parts that need to be different 
into two separate files, so far less chance that you'll confuse the two 
actions : much less likely that something that should only occur in a 
new action will pop up in an edit action.

You've also reduced the number of times you need to run the if. Just 
once - to decide which middle template to use, rather than at every 
point in the single template where a choice needs to be made.

I think your developer is demonstrating a fundamental lack of 
understanding about how Rails templates work.

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