[Rails] Two table edition in one time

Helo, I'm starting small app in rails and I found a problem.
There are two databases:
customer (id,name,surname)
device(id,customer_id,mac)

I'would like to insert new device with new customer data..
something like:
http://localhost:3000/Customer should show me fields:
New Customer
Name ______________
Surname ____________
Mac _____________

Editing also should change values in both databases..
How acomplish that ?
I try to add belongs_to :customer into device model but it fail ...

···

--
Marcin Jurczuk, NIC-HDL: MJ1679-RIPE