I took the easy way out and changed _haml_local_assigns to local_assigns because I agree it's best to look as much like the standard templating system as possible. Though, I really dislike that they picked a normal looking variable identifier for this thing that is clearly intended to be guts.
- Tom On Jul 23, 6:29 pm, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote: > I would like to keep with the interface of ActionView as much as > possible, even when it's not public. This is important for keeping > compatibility with Rails helpers. > > Tom, since we're assigning locals as actual locals, I imagine we can't > do anything quite as simple as Steve's suggestion. Can you think of an > easier way to do this than dynamically defining a method? > > - Nathan > > Tom Bagby wrote: > > They do have the same function and are both implementation details. > > The only reference to it I see in the ActionView documentation that is > > not in a protected method for dealing with template compiled methods > > is this: > > > <quote> > > If you need to find out whether a certain local variable has been > > assigned a value in a particular render call, you need to use the > > following pattern: > > > <% if local_assigns.has_key? :headline %> > > Headline: <%= headline %> > > <% end %> > > > Testing using defined? headline will not work. This is an > > implementation restriction. > > </quote> > > > I am pretty sure this isn't true. I've tested using defined? in an > > rhtml template and it worked fine for me. They are implemented as > > normal local variables now so I don't see why you would need this. > > ActionView in the semi-recent past was defining methods to simulate > > local variables (as was Haml), possibly this was a work around. > > > Anyway, might be nice to change purely for consistency, but it's not > > part of the public interface of ActionView. ActionView documentation > > should probably be updated to remove that unnecessary pattern. > > > -Tom > > > On Jul 23, 11:21 am, Mike Ferrier <[EMAIL PROTECTED]> wrote: > > >> Hi, > > >> My esteemed colleague Jeff Hardy has pointed out that the local > >> variable _haml_local_assigns inside a Haml template contains the same > >> information as the local_assigns hash local variable that is available > >> in an erb template. This seems like an inconsistency with the template > >> interface that Rails developers expect to have, as the > >> ActionView::Base documentation refers to the local_assigns hash > >> explicitly. > > >> Thoughts anyone? > > >> Mike > > >> On Jul 22, 7:09 pm, Mike Ferrier <[EMAIL PROTECTED]> wrote: > > >>> I was trying to figure out why I had no local_assigns hash to look at > >>> from within a Haml partial rendered with a :locals hash; I renamed it > >>> to .rhtml and ran it again and local_assigns had magically appeared. > > >>> Anyone ran into this before? Is there any way to get at the > >>> local_assigns hash from inside a Haml template? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Haml" 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/haml?hl=en -~----------~----~----~----~------~----~------~--~---
