В общем «лыжы не едут» уже с утра. Скорее всего ошибка банальная но я в упор ее не вижу.
irb(main):109:0> Customer.all
Customer Load (0.3ms) SELECT "customers".* FROM "customers"
=> []
irb(main):111:0> CustomerScript.all
CustomerScript Load (0.1ms) SELECT "customer_scripts".* FROM "customer_scripts"
=> []
irb(main):112:0> c = Customer.new(:name => 'Jack', :email => 'one@ya.ru')
=> #<Customer id: nil, name: "Jack", email: "one@ya.ru", cuid: nil, note: nil, created_at: nil, updated_at: nil>
irb(main):113:0> s = CustomerScript.new(:script_id => 1, :instances => 2)
=> #<CustomerScript id: nil, script_id: 1, customer_id: nil, browser_version: nil, instances: 2, verified: nil, created_at: nil, updated_at: nil>
irb(main):114:0> c.scripts << s
=> [#<CustomerScript id: nil, script_id: 1, customer_id: nil, browser_version: nil, instances: 2, verified: nil, created_at: nil, updated_at: nil>]
irb(main):115:0> c.scripts.size
=> 1
irb(main):116:0> c.save
(0.2ms) begin transaction
Customer Exists (0.4ms) SELECT 1 AS one FROM "customers" WHERE "customers"."email" = 'one@ya.ru' LIMIT 1
SQL (1.0ms) INSERT INTO "customers" ("created_at", "cuid", "email", "name", "note", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["created_at", Wed, 23 Oct 2013 08:06:41 UTC +00:00], ["cuid", nil], ["email", "one@ya.ru"], ["name", "Jack"], ["note", nil], ["updated_at", Wed, 23 Oct 2013 08:06:41 UTC +00:00]]
(0.3ms) rollback transaction
=> nil
irb(main):117:0> c.errors.messages
=> {}
irb(main):118:0> c.scripts[0].errors.messages
=> {}
irb(main):119:0> Customer.all.size
Customer Load (0.6ms) SELECT "customers".* FROM "customers"
=> 0
irb(main):120:0> CustomerScript.all.size
CustomerScript Load (0.4ms) SELECT "customer_scripts".* FROM "customer_scripts"
=> 0
irb(main):121:0>
база была предварительно пересоздана.
буду благодарен если вы меня ткните носом в ошибку