I have a strange postgres table mapped in this way with rails AR:
class Data::Doctor < ActiveRecord::Base
self.table_name = 'tb_utenti'
self.primary_key = "codice_utente"
# other stuff ...
end
then i defined the fabricator:
Fabricator(:doctor, class_name: "Data::Doctor") do
codice_utente { SecureRandom.uuid }
# other attributes ...
end
but i retrieved an error in rspec example:
Failure/Error: Fabricate.build(model_s, attributes)
ActiveRecord::StatementInvalid:
PG::UndefinedTable: ERROR: relation "tb_utenti" does not exist
LINE 5: WHERE a.attrelid = '"tb_utenti"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"tb_utenti"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
I have a strange postgres table mapped in this way with rails AR:
then i defined the fabricator:
but i retrieved an error in rspec example:
ruby 2.2.5 rails 4.2.8