Hi,
Been working through the book. Find this really fascinating
considering how much time I can save in future. Relatively new to Ruby/
Rails. Very new to Hobo. I shall appreciate if you could comment/
assist with what I am trying to do do.
I have two models (see) below.
All's fine with migrate and the database but how do I get this to play
on forms.
class Shipment < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
no :string
fname :string
lname :string
phone :string
mobile :string
fax :string
email :string
timestamps
end
has_one :physical_address, :dependent => :destroy, :as
=> :addressable, :class_name => "Address", :conditions =>
"address_type = 'Physical'"
has_one :postal_address, :dependent => :destroy, :as
=> :addressable, :class_name => "Address", :conditions =>
"address_type = 'Postal'"
has_one :shipping_address, :dependent => :destroy, :as
=> :addressable, :class_name => "Address", :conditions =>
"address_type = 'Shipping'"
accepts_nested_attributes_for :physical_address, :allow_destroy =>
true
accepts_nested_attributes_for :postal_address, :allow_destroy =>
true
accepts_nested_attributes_for :shipping_address, :allow_destroy =>
true
. . . .
class Address < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
address :string
city :string
state :string
zip :string
country :string
address_type :string
timestamps
end
belongs_to :addressable, :polymorphic => true
scope :physical, :conditions => "address_type='Physical'"
scope :postal, :conditions => "address_type='Postal'"
scope :shipping, :conditions => "address_type='Shipping'"
. . .
--
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.