good point. i guess you could use @item[:updated_at] to avoid
behavioral ambiguity. the 5 is just @item.id. 'item_5_updated_at'
would work equally well, if that's the preferable convention.

On Feb 12, 9:44 pm, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
> I understand the goal, but I'm having trouble getting the exact
> behavior... how, for instance would you differentiate between
> [EMAIL PROTECTED], which is a Person and thus should have class "person" and
> id "person_123" and [EMAIL PROTECTED], which is a date, and apparently
> should have class "item_updated_at" and id "item_updated_at_5"? Where is
> that 5 coming from? How do you tell what the method name is?
>
> - Nathan
>
>
>
> Drew Sears wrote:
> > the goal would just be to have a unique class and id for one attribute
> > of a particular object, for ajax updates. so, i might use the
> > following haml:
>
> > [EMAIL PROTECTED]
> >   = @item.name
> >   was updated at
> >   [EMAIL PROTECTED] @item.updated_at
>
> > to generate this html:
>
> > <div class="item" id="item_5">
> >   my fifth item
> >   was updated at
> >   <span class="item_updated_at" id="item_updated_at_5">2006-07-29</
> > span>
> > </div>
>
> > some javascript elsewhere would look like this:
>
> > <script>
> >   function set_item_updated(id, val) {
> >     $('item_updated_at_'+id).inner_html = val;
> >   }
> >   set_item_updated(5, 'asdf');
> > </script>- Hide quoted text -
>
> - Show quoted text -


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

Reply via email to