I have this in my group_spec.rb file:
describe Group do it { should have_many(:users) } end
and this is in my user_spec.rb file:
describe User do it { should belong_to(:group) } end
When I run the tests, I get:
Failure/Error: it { should have_many(:users) } ActiveRecord::StatementInvalid: PGError: ERROR: relation "users" does not exist LINE 4: WHERE a.attrelid = '"users"'::regclass ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"users"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum
In my group.rb file, I have:
has_many :users
And in my users.rb file I have:
belongs_to :group
I feel that I am missing something that should be obvious. Any help would be greatly appreciated. Thanks!
John
source share