[Rails] Newbie question/help 2 tables, 'sync' cell values
Alexandru Andrei
alexandrei at gmx.net
Fri Dec 23 12:36:40 GMT 2005
I have to << search for each problems.room_id=rooms.id and do
problems.room_no=rooms.room >>
HOW?
More details:
I have the following tables:
- a "rooms" table, with fields (id,room,create...)
- a "problems" table with fields (id,room_id,room_no, ...)
problem.rb has
belongs_to :room
validates_associated :room
and room.rb has
validates_length_of :room, :within => 1..20
validates_uniqueness_of :room, :message => "already exists!"
has_many :problems
For "problems" in the edit/add form (_form partial) I have a drop down
that named "Room no" that actually sets the value for room_id in the
problems table.
How can I set the value of room_no field in the 'problems' table (to be
the 'room' field in rooms?
Thank you, I hope this make sense...
--
Posted via http://www.ruby-forum.com/.
More information about the Rails
mailing list