I would think partials would serve you (laying out vars populated in the 
appropriate controller).

Have you looked at those at all?

-----Original Message-----
From: rubyonrails-talk@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Christo Karlson
Sent: Wednesday, October 22, 2008 3:10 PM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] Re: Subtemplating with ERB


I have the same problem.
I am translating an old ASP-application (pre dot.net) that uses textual 
includes to implement DRY.
When I try to use ERB for this I get scoping problems

* Variables or functions declared in the subtemplate I try to read with erb are 
not 'remembered' when returning to the main view (that did the erb call)

Note. if a variable was declared the first time in the main view it is possible 
to change the value of that variable in the subtemplate and that new value is 
'remembered'.

I can't see how you can implement good DRY-solution in ruby/rails given the 
above problem but it should be possible since ruby/rails is a much newer/more 
modern framework than old asp.

Of course you can put the methods in an helper method but then you don't have 
access to the <% %> tags and you don't have access to variables declared in the 
view.

Very grateful for any help!

/Kristofer
--
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 rubyonrails-talk@googlegroups.com
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