Created
May 9, 2011 08:36
-
-
Save Marchino/962240 to your computer and use it in GitHub Desktop.
Extension of devise RegistrationController
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
require 'mmplus/mmplus_users_resolver' | |
class Users::RegistrationsController < Devise::RegistrationsController | |
append_view_path MmplusUsersResolver.new | |
protected | |
def render_with_scope(action, path=self.controller_path) | |
build_nested_attributes if request.get? or resource.errors.empty? | |
super | |
end | |
def build_nested_attributes | |
resource.build_profile if resource.profile.nil? | |
resource.build_billing_address if resource.billing_address.nil? | |
resource.shipping_addresses.build if resource.shipping_addresses.empty? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment