app/controllers/users/registrations_controller.rb
def create
        super do |resource| # super do oznacza ze dziedziczymy akcje "create" i rozszerzamy ją
            if params[:plan]
                resource.plan_id = params[:plan]
                if resource.plan_id == 2
                    resource.save_with_subscription 
                else
                    resource.save
                end
            end
        end
    end
# Extend default Devise gem behavior so that 
# users signing up with the Pro account (plan_id 2)
# save with a special Stripe subscription function.
# Otherwise Devise signs up uesr as usual.
Extend default Devise gem behavior so that
users signing up with the Pro account (plan_id 2)
save with a special Stripe subscription function.
Otherwise Devise signs up uesr as usual.
Extend default Devise gem behavior so that users signing up with the Pro account ( plan_id 2 ) save with a special Stripe subscription function . Otherwise Devise signs up uesr as usual .
def create
        super do |resource| 
            if params[:plan]
                resource.plan_id = params[:plan]
                if resource.plan_id == 2
                    resource.save_with_subscription 
                else
                    resource.save
                end
            end
        end
    end
def create super do | resource | if params [ :plan ] resource . plan_id = params [ :plan ] if resource . plan_id == 2 resource . save_with_subscription else resource . save end end end end
Extend default Devise gem behavior so that
users signing up with the Pro account (plan_id 2)
save with a special Stripe subscription function.
Extend default Devise gem behavior so that users signing up with the Pro account ( plan_id 2 ) save with a special Stripe subscription function .
# super do oznacza ze dziedziczymy akcje "create" i rozszerzamy ją