Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8195059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:00:31+00:00 2026-06-07T05:00:31+00:00

I have a User model that I am using devise for. Each User belongs_to

  • 0

I have a User model that I am using devise for. Each User belongs_to a Group. I am trying to find an easy way to set a user’s group on sign up – without creating a custom controller to override devise?.

My models look like this:

class User < ActiveRecord::Base
  belongs_to :group
end

class Group < ActiveRecord::Base
  has_many :users
end

Here’s the form:

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>

<%= f.label :email %><br />
<%= f.email_field :email %>

<%= f.label :password %><br />
<%= f.password_field :password %>

<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %>

<%= label_tag :group_name %>
<%= text_field_tag :group_name %>

<%= f.submit "Sign up" %>

Since I’m only trying to save this one additional attribute (group_name), I would like to avoid creating a whole new custom devise controller. Is there a way to save a user’s group at the model level – with a callback maybe? Or is there a better way to save a group on sign up?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:00:32+00:00Added an answer on June 7, 2026 at 5:00 am

    If you’ve already using a customized form as shown above (that is, you’re not using the one Devise gives you) there should be no reason you need to override a Devise controller. The group will just be mass assigned along with the other mass-assignable attributes.

    (Personally, in terms of user experience, it might be nice to make the group selection a drop down or something, just so that it’s usable, but that’s just a matter of preference. An autofill might be nice too.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails app that is using Devise, with a User model, no
I have a user model that is generated using Devise. I am extending this
I'm using Devise and I'm trying to set up an invite code that the
I am using Devise in Rails 3, and have a User model in rails
I'm using Devise and have models set up like this: User has_one :profile Profile
I have a User model that Devise manages - i.e. all users have email
I have a user model that requires the user to change their password every
I have a User model that has the following default_scope: default_scope where(account_id: Account.current_account.id) If
I have a model that has a ForeignKey to the built-in user model in
I have a model that looks like this: class Invite(models.Model): user = models.ForeignKey(User) event

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.