Forum: Ruby on Rails div_for and RJS

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ec0974ef464e0b454d7a33f464685bb7?d=identicon&s=25 Noel Miller (radkin)
on 2009-05-08 23:05
Do you have to use an activeRecord object for div_for?
Perhaps I'm taking the wrong approach for "dynamic" divs

so far my education:

1. id= , is fine for just one div and prototype activity in an RJS (I
got this to work)
2. class= , another option, but I don't see how it can be used
3. div_for , a helper that uses ActiveRecord objects to come up with
multiple divs

Below: code that is my best guess for how to proceed, but it doesn't do
everything it is supposed to do:


<script src='http://pastie.org/472556.js'></script>

<script src='http://pastie.org/472563.js'></script>
Ec0974ef464e0b454d7a33f464685bb7?d=identicon&s=25 Noel Miller (radkin)
on 2009-05-08 23:08
the code is here
http://pastie.org/472556
and here
http://pastie.org/472563

sorry about the extra bits
4c438a80fc30661ad619ea177cf9cbd0?d=identicon&s=25 Freddy Andersen (Guest)
on 2009-05-09 01:32
(Received via mailing list)
The class will not work for a rjs call.. html class elements are not
unique by design so that is not a good idea anywho...

Here is a good description for div_for
http://apidock.com/rails/ActionView/Helpers/Record...

It's just a way to create a div that has something todo with the
record that you have. So if you have a @user object with id of 1 you
would get id="user_1" for the div.
This topic is locked and can not be replied to.