Displaying 2 results from an estimated 2 matches for "origin_country".
2007 Mar 20
2
collection_select - why doesn't it work?
Hi all
I guess this is quite a newbie question, but I''m just stuck here and
don''t know why.
<%= form.collection_select :origin_country, Country.find(:all), :id,
:name %>
gives me a select list with name="member[origin_country]". When
submitting the form the following error is shown:
Country expected, got String
When I try
<%= form.collection_select :origin_country_id, Country.find(:all), :id,
:name %>
I get...
2007 Nov 27
0
Working with one model from another
...ds into the String class.
I understand this might be less-than-sensible as models should normally
stand on their own..?
My two models:
#######################
# models/qualified_name.rb #
#######################
# t.column :make, :text
# t.column :model, :text
# t.column :origin_country, :text
class QualifiedName < ActiveRecord::Base
# Work some magic -- let''s populate the instance using the raw name
string (e.g. "Honda Civic")
def magically_understand(name_string)
raw_name = RawName.new(name_string)
if raw_name.is_one_word then
self.ma...