Hi,

I always found one thing severely missing from Rails' partials: an
equally easy "Rails" way to not just share view templates easily even
across controllers, but also have certain controller code associated
with a partial needed to get certain variables for the partial. Right
now there is no code associated with a partial, it's just a view
template. That's bad sometimes, because not always is the code for
setting variables used in the template different between usages of
that one template.

Right now I have to duplicate the code though, and especially when
using a template from a different controller this is very awkward,
since I cannot just create a new local method for the shared code. I'd
have to put it in ApplicationController, for example, but it really
belongs into the controller "owning" the particular partial.

One usage example which I'm using right now:
Instead of a different page for the shopping cart, adding addresses
and performing payment I want ONE page with all of them, saving the
user clicks and letting them see the entire (very short) process at
once on a long scroll. This has been proven to lead to a better user
experience compared to splitting (a very simple process in my case)
into lots of tiny pieces (but even if not, it's what I want).

As you can see I'd have to duplicate code from shopping_carts/index,
addresses/index, orders/new for that page, even though all those
pieces of code clearly logically belong into their respective
controllers. If I could have partials that automatically run a local
"per partial" method of their owning controller when called to
render...

How do YOU guys solve such a situation?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en.

Reply via email to