I think you need this:
:theater belongs_to :status (rather than has_one :status). Then add
status_id to your theaters table.
You can then call the status name like this:
<%= theater.status.name %>
On Nov 6, 2006, at 1:51 PM, Patrick Crowley wrote:
I'm stuck trying to setup a has_one relationship on my Cinema
Treasures project (which has a legacy db).
Need to display the status of a theater -- whether the theater is
open, closed, etc. -- for each theater in a list of theaters.
Theater has_one :status
Status has_many :theaters
The status table has two fields: an id field and a name field
(which has the full name for each status). Each theater has a field
called status_id, which is used to join the theater and status tables.
...
How can I display the name form of the theater status in this example?
<% for theater in @theaters %>
<%= theater.name %>
<%= NEED TO DISPLAY STATUS NAME HERE %>
<% end %>
Best,
Patrick
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby