my situation:
manufacturer.rb:
# id :integer not null, primary key
# name :string(255)
has_many :ouis
has_many :phones
oui.rb
# id :integer not null, primary key
# value :string(255)
# manufacturer_id :integer
belongs_to :manufacturer
phone.rb
# id :integer not null, primary key
# mac_address :string(255)
# manufacturer_id :integer
belongs_to :manufacturer
The Oui stores the first 6 digists of the mac address in the field
value. A phone's mac address (stored in mac_address) has to start with
these 6 digits. I wrote a validation for that. The validation works
but I can't find out how I can create a factory for phone which
creates a manufacturer factory with a oui factory and than uses the
value field of that last factory to generate a random mac_address for
the phone.
Could someone tell me the magic to solve this?
Stefan
--
AMOOMA GmbH - Bachstr. 124 - 56566 Neuwied --> http://www.amooma.de
Geschäftsführer: Stefan Wintermeyer, Handelsregister Montabaur B14998
Bücher: http://das-asterisk-buch.de - http://ruby-auf-schienen.de
--
Individuals over processes. Interactions over tools. Agile Rails training from thoughtbot, the makers of Clearance, Shoulda, & Factory Girl:
http://thoughtbot.com/services/training
You received this message because you are subscribed to the "factory_girl" mailing list.
To post to this group, send email to factor...@googlegroups.com
To unsubscribe from this group, send email to
factory_girl...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/factory_girl?hl=en
Bingo!
Thank you so much.