Sha256: 461deecb5c1da27ea3e17f969d0d4de051329f51d0b79eb7e9f7d43d75ac052d

Contents?: true

Size: 800 Bytes

Versions: 6

Compression:

Stored size: 800 Bytes

Contents

require_dependency "cardboard/application_controller"

module Cardboard
  class MyAccountController < ApplicationController

    def edit
      @user =  cardboard_user
    end

    def update
      admin_user_method = Cardboard.user_class.to_s.underscore.gsub(/\//,'_').to_sym
      @user =  cardboard_user
      if params[admin_user_method][:password].blank?
        params[admin_user_method].delete("password")
        params[admin_user_method].delete("password_confirmation")
      end

      if @user.update_attributes(strong_params[admin_user_method])
        request.env['warden'].session_serializer.store(@user, admin_user_method)
        flash[:success] = "User information updated successfully"
        redirect_to my_account_path
      else
        render :edit
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cardboard_cms-0.3.1 app/controllers/cardboard/my_account_controller.rb
cardboard_cms-0.2.2 app/controllers/cardboard/my_account_controller.rb
cardboard_cms-0.2.1 app/controllers/cardboard/my_account_controller.rb
cardboard_cms-0.1.8 app/controllers/cardboard/my_account_controller.rb
cardboard_cms-0.1.6 app/controllers/cardboard/my_account_controller.rb
cardboard_cms-0.1.4 app/controllers/cardboard/my_account_controller.rb