Sha256: 9f75a9eaba028baf80b89c7da855cad14c46674f4d40cef6d87c0a3c0cf3b476

Contents?: true

Size: 1.09 KB

Versions: 40

Compression:

Stored size: 1.09 KB

Contents

require_dependency "faalis/application_controller"

module Faalis
  class API::V1::ProfilesController < ::APIController

    def show
      @user = current_user
      respond_with(@user)
    end

    def update
      @user = current_user
      user_fields = {
        :first_name => params[:first_name],
        :last_name => params[:last_name],
        :email => params[:email],
      }

      if params.include? :password and params[:password]
        user_fields[:password] =  params[:password]
        user_fields[:password_confirmation] =  params[:password_confirmation]

        if @user.update(user_fields)
          respond_with(@user)
        else
          respond_to do |format|
            format.json { render :json => {:fields => @user.errors}, :status => :unprocessable_entity }
          end
        end
      else

        if @user.update_without_password(user_fields)
          respond_with(@user)
        else
          respond_to do |format|
            format.json { render :json => {:fields => @user.errors}, :status => :unprocessable_entity }
          end
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
faalis-2.0.8 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-2.0.7 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-2.0.5 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-2.0.4 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-2.0.3 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-2.0.1 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-2.0.0 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-2.0.0.rc6 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-2.0.0.rc5 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-2.0.0.rc4 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-2.0.0.rc3 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-2.0.0.rc2 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-1.0.0 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-1.0.0.alpha4 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-1.0.0.alpha3 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-1.0.0.alpha2 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-1.0.0.alpha1 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-1.0.0.alpha0 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-0.26.3 app/controllers/faalis/api/v1/profiles_controller.rb
faalis-0.26.2 app/controllers/faalis/api/v1/profiles_controller.rb