about summary refs log tree commit diff
path: root/app/controllers/auth/registrations_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/auth/registrations_controller.rb')
-rw-r--r--app/controllers/auth/registrations_controller.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb
new file mode 100644
index 000000000..3114ae60a
--- /dev/null
+++ b/app/controllers/auth/registrations_controller.rb
@@ -0,0 +1,22 @@
+class Auth::RegistrationsController < Devise::RegistrationsController
+  layout 'auth'
+
+  before_filter :configure_sign_up_params, only: [:create]
+
+  protected
+
+  def build_resource(hash = nil)
+    super(hash)
+    self.resource.build_account if self.resource.account.nil?
+  end
+
+  def configure_sign_up_params
+    devise_parameter_sanitizer.for(:sign_up) do |u|
+      u.permit(:email, :password, :password_confirmation, account_attributes: [:username])
+    end
+  end
+
+  def after_sign_up_path_for(resource)
+    account_path(resource.account)
+  end
+end