Created
March 28, 2011 02:41
-
-
Save andrewculver/889917 to your computer and use it in GitHub Desktop.
Assign non-form data to a new user on sign-up with Devise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RegistrationsController < Devise::RegistrationsController | |
protected | |
def build_resource(hash=nil) | |
# let devise do it's magic with the form data. | |
super | |
# assign any additional information the form doesn't populate. | |
# (e.g. @organization is populated in ApplicationController.) | |
resource.organization = @organization | |
# maintain the existing interface | |
self.resource | |
end | |
end | |
# Also, update routes.rb to utilize your new registrations controller. | |
# devise_for :users, :controllers => {:registrations => "registrations"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment