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