Forum: Ruby on Rails Making a custom selection form - newbie

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.
6ec1e89eef5ce09fbfa56be5b6dd17b5?d=identicon&s=25 Adam Bloom (admanb)
on 2006-03-27 00:05
Hello all,

I've been working with Ruby on Rails for a few weeks now. It's difficult
for me because I don't have much experience with Ruby, Rails, MySQL, or
any other web-languages. But I'm trudging on and learning a lot.

I've been working on a web application for my dad's website; it's a
simple content manager for "listings." Using the scaffolding and other
stuff I've learned I was able to set up the basic system easily, but the
categories are not so simple.

Categories are a model: they habtm (has_and_belong_to_many) listings,
and listings habtm categories. This way an individual listing can
display its categories, and a category can display its listings.
Categories are also trees: each major category contains a variety of
sub-categories.

The difficult part is creating the UI to create a listing: a listing can
have one or two main categories, and one or more sub-categories within
those main categories. The UI needs to be user-friendly, as clients are
going to be creating the listings.

I've tried everything that I've learned about FormHelpers, but I don't
think they can do what I want. So now I'm assuming that I'm going to
have to write a bunch of Ruby code that creates a "select" form but more
complex. I'm hoping to get something that looks like this (only
prettier, and with meaningful categories):

Categories:

Monkeys
Lions
Elephants

Click on Lions, it changes color to indicate selection, and the page
changes to this:

Monkeys
Lions
  Taming
  Feeding
  Breeding
Elephants

Click on a sub-category and it lights up. Send the form (which will also
include normal text fields) and the selected categories are added to the
data.

I'm not really looking for code here; I learn a lot when I do things
myself. What I'm interested is some sort of idea of how to get started,
what new tools I'll need to understand, and so on.
6ec1e89eef5ce09fbfa56be5b6dd17b5?d=identicon&s=25 Adam Bloom (admanb)
on 2006-03-27 21:06
Anybody? :)
6ef8cb7cd7cd58077f0b57e4fa49a969?d=identicon&s=25 Brian Hogan (Guest)
on 2006-03-27 21:46
(Received via mailing list)
Perhaps you want to look here:

http://jrhicks.net/Projects/rails/has_many_and_bel...

>From there, I believe you will be able to determine how best to handle your
specific situation.
6ec1e89eef5ce09fbfa56be5b6dd17b5?d=identicon&s=25 Adam Bloom (admanb)
on 2006-03-28 20:39
Thanks! I'll take a look at that.

-Adam
This topic is locked and can not be replied to.