First off, I'm fairly new to ruby on rails so this may appear simple but
I'm just learning the ropes :)

So I have a simple blog app where a post has many comments. The 'show'
view for posts renders a partial for each comment the post has. The css
class of the containing div element is cycled using cycle(). The partial
code is,

<% div_for(comment, :class => cycle("blue","white")) do %>
<p><span class='commentdate'><%=
comment.created_at.strftime("#{comment.created_at.day.ordinalize} %b
%Y") %></span>
<strong><%= h(comment.name) %></strong><span class='grey'>
says:</span></p>
<p><%= h(comment.content) %></p>
<% end %>


This works fine when you first render the page... however when you add a
new comment via ajax it inserts an additional partial... but the cycle
seems to have reset itself and the css class will always be blue. Is
there a means to make sure that the cycle continues on from the previous
rendering of the partial? Or perhaps a more elegant way of doing it
altogether?

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