the scenario...
three tables, thusly:
widgets
-------
id
widget_color_id
widget_style_id
widget_colors
-------------
id
color
widget_style
------------
id
style
the data:
widgets
-------
1 2 1
2 1 3
3 3 2
widget_colors
-------------
1 blue
2 red
3 green
widget_styles
-------------
1 smooth
2 round
3 broken
so, putting the associations together, we have in widgets:
1 red smooth
2 blue broken
3 green round
the reality...
if I populate a form view with dropdowns for colors and
styles using options_from_collection_for_select, I can
quite nicely create a new widget by selecting the appropriate
values and clicking "Submit".
the wishlist...
is it possible to instead of a dropdown have a textbox
where the user can enter *any* color or style, and have
both the widget table AND the foreign table update with
the entered info?
for example, user enters "yellow" in one textbox and
"smashed"
in the other... widget_colors adds row "yellow", widget_styles
adds row "smashed," and widgets adds row "4 4" (pointing to
the
foreign table ids).
looking through the ActiveRecord documentation, I''m not sure
if this is possible. right now, I have separate pages to add
additional widget colors and styles, which is ok from an admin
standpoint but i''d like to make it more centralized for end-users.
right now i don''t care about validation or duplicate entries,
I just want to know if it is possible. Thanks!