Greetings, Hoboists!

Quick Intro: I know Ruby fairly well, Rails less so, and am just
starting to learn Hobo. I wanted to work through the tutorials, and
apply what I'm learning to a real life project.

So far so good...ish. Most of the tutorials are very clear, and the
books have helped a great deal. Now, though, I'm stuck with a design
issue that I'm having trouble working out. If there's anyone out there
who can point me toward resources for solving it, I would be very
grateful.

I'm building a library app for my sister that will keep track of her b-
movie collection for her and her friends. I'm starting out with just
two resources - films and actors - and want to get this all worked out
before I try throwing directors, studios and comments at it.

What should happen is when she enters a new movie, she should be able
to assign actors to it. When she then goes to the actors' individual
pages, the movies they were assigned to should display.

I've tried this two ways. Method #1 was using the 'has_many :x through
=> :x-assignments' (as was shown in the Rapid Rails with Hobo book,
Tut 8, "Model Relationships, Pt II), which worked - sort of. I was
able to add actors to the film record, and films to actor records, but
the relationships didn't reflect in both record sets. I could set it
manually through SQL statements, but otherwise there was no way to do
it through the app itself.

As an example, I was able to add "Plan 9 from Outer Space" and could
select "Tor Johnson" as an actor for that film, but when I went to Tor
Johnson's actor record, it didn't show "Plan 9 from Outer Space" as a
film he was in. I'm assuming because the two different transactions
updated two different index tables (film_assignments and
actor_assignments).

Method #2 was to try using a single index table, films_actors, and use
"has_many_and_belongs_to" to establish the relationship. It worked
fine except that there was now no mechanism in the Film form to add
actors at all.

I was reading that Method #1 is the preferred Hobo way of relating
models, but I'm wondering if I missed something critical in
establishing the relationship?

Thanks for reading!
-
Jack

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en.

Reply via email to