Search code examples
ruby-on-railsspreecancanrole

Spree - Create users with other role


I'm trying to create users with different role than user. How can I do it? I didn't see anything about role in the new user function.

Thanks!


Solution

  • You can do following:

    role =  Spree::Roles.create( name: "something" )
    your_user.spree_roles = role