> I'd be very thankful for any advice!! Perhaps there are good examples
> on the web? I tried to understand Eloy's example, but it's quite
> difficult.
> 
> Best regards
Yes, it's very much on the level of "here's how to ride a bike, now go 
off and race a Formula 1 car, remember to break on the corners"

The example is very fragile, there's lots of different bits to it all 
over the place and they have to fit together just right or it won't 
work. So when you move the example over into your own code you'll get 
caught out trying to work out what has to stay the same and what can be 
changed.

I think he expects you to be a hard core coder to be able to understand 
what's going on. But here's a few clues I've picked up from reading 
through it.

1) You'll need to understand how delegation works in unobtrusive 
javascript. That business of <body><div id="container"> blah blah 
</div></body> is crucial to get the thing to work.

2) It creates a template for each type of association on the nested 
level, and you're expected to have a partial with the singularized name 
of the association which can be used to generate the template.

3) When you create a new nested record, the js code copies the template, 
replaces the string "NEW_RECORD" with a time stamp and puts it inside 
the div with the id set as the pluralized name of the association, at 
the bottom.

I'm trying to get it to work with has_and_belongs_to_many associations 
and it doesn't. Reading the code it looks like it can't work with habtm 
associations without a bit of a rethink, it uses record ids which is 
fine for hm associations, but not for habtm. You mention that you need 
to set things up for different object classes, so it sounds like you 
might be using polymorphic associations. It might not work with them 
either.

I've given up with it, I'm writing my own code to handle habtm.

John Small



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