Hello
I have a js view, say, things/index.js.erb that looks like this:
$('my-stuff').update("<%= escape_javascript(render :partial =>
'shared/thing', :collection => @things) %>");
Effect.toggle('my-stuff', 'slide');
The idea is that the div with id 'my-stuff' will slide down and show
the collection when a certain link is clicked, and it'll slide up if
clicked again. The problem is that on the second click, the file is
parsed again by erb, which results in a query being made to the
database to fetch the @things collection. This is unnecessry because
the content is already displayed and is now being hidden from the
user.
Is there any way to detect that situation and avoid that extra query?
Thanks,
Andre
--
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.