Hi all, I just discovered Hobo and it seems great, but I'm trying to
wrap my head around the differences from Rails w/o Hobo (while I try
to wrap my head around Ruby/Rails, coming from Python).
Anyway, I can't find any way to explicitly reference another column,
but it occurs to me that I may be misunderstanding how Hobo is using
tables. What I'm trying to do is seed my database with model
references, the way I've been able to do in vanilla Rails.
I can simplify my application to two models to demonstrate:
------
class Unit < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
name :string
abbr :string
dimensions :xml
timestamps
end
belongs_to :variable
…
----------------------
class Variable < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
name :string
description :string
timestamps
end
has_many :units
…
end
---------
What I'm trying to do is seed the database such as:
Unit.create(:name => "fahrenheit", :abbr => "F", :dimensions =>
'<dimensions temperature="1" />')
Variable.create(:name => "temperature", :unit => Unit.find
(:first, :conditions => {:name => "fahrenheit"}), :description =>
"Fahrenheit temp")
but the db:seed command fails because :unit is an unknown attribute.
So, my question is how do I seed a database with references to other
models?
Thanks,
-J
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.