You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
Currently there is no way to populate has_and_belongs_to_many because there is no model set apart for the join table. There should be additional methods one can call on either side of the association to setup the join.
The text was updated successfully, but these errors were encountered:
really need this... I thought it might be possible by populating the join table separately... But I can't even figure out how to populate a table with no "id" field.... I get this error when I tried to do that...
Mysql2::Error: Unknown column 'id' in 'field list': SELECT id FROM roles_users ORDER BY id DESC
I am populating a join table by joining with one table as seen in your example and then using a random function to generate id's for the other table. It's not perfect but I need a lot of data to test with and this at least fills up the db.
To populate a table with no 'id' field I wrote a rescue block around the last_id_in_database function (factory.rb line 75). The populate then works as expected as the id field is not needed to populate the data. I would much prefer a nicer method though Ryan.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently there is no way to populate has_and_belongs_to_many because there is no model set apart for the join table. There should be additional methods one can call on either side of the association to setup the join.
The text was updated successfully, but these errors were encountered: