Hi,
I have a form with a set of fields. All these fields belong to a table
called Textmaze. One of the form fields is a list box. This list box
gets it’s values from an existing table called Scenario in the
database. On submission of the form, it should create a record in a
table. Connection between these two tables looks like this:
class Textmaze < ActiveRecord::Base
belongs_to :starting_scenario,
:class_name => “Scenario”,
:foreign_key => “starting_scenario”
end
My form code looks like this:
<select id="textmaze_starting_scenario"
name=“textmaze[starting_scenario]”>
<% @scenarios.each do |scenario| %>
<%= scenario.title %>
<% end %>
When I submit the form I get an error saying “Scenario expected, got
String”
Instead of I tried supplying the id
of the Scenario record but even that doesn’t seem to work. What could
be wrong?
How can I get reference to another table’s record into my table?