I’m trying to figure out the command to update my roles_users model using the console. Am using cancan with devise and I’m trying to set up my seeds.rb. I wanted to test first.
My users have many roles and vice versa. Everything is working fine and my roles_users table has been populated.
What I’m trying to figure out is how to update a user in the console.
I can see from my development log the following happens:
INSERT INTO "roles_users" ("role_id", "user_id") VALUES (3, 1)
How can I do exactly this in the console??
Thanks
User.find(user_id).roles << Role.find(role_id)