Displaying 1 result from an estimated 1 matches for "magically_understand".
2007 Nov 27
0
Working with one model from another
...#####################
# 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.make = raw_name.contents
else
if raw_name.is_two_words then
self.make = raw_name.words.first
self.model = raw_name.words.last
end
end
if raw_name.make_could_be_j...