I have three models User, Roles and User Roles.
associations
class User < ApplicationRecord
has_one :role, through: :user_role
has_one :user_role, dependent: :destroy
end
class Role < ApplicationRecord
has_many :user_roles
has_many :user, through: :user_roles
end
class UserRole < ApplicationRecord
belongs_to :admin_user
belongs_to :role
end
how do I create a form for user such that user can create new user with a role
I want to create a user with a single role. Most of the implementation I have seen has a add role button for multiple role. I want the user to have only one role
New contributor