- api to update name and email - api to change password - api to set profile pic - fixes update_attribute! deprecation warning - introducing active storage
This commit is contained in:
@@ -13,7 +13,7 @@ class Api::V1::AgentsController < Api::BaseController
|
||||
end
|
||||
|
||||
def update
|
||||
@agent.update_attributes!(agent_params)
|
||||
@agent.update!(agent_params)
|
||||
render json: @agent
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class Api::V1::CallbacksController < ApplicationController
|
||||
|
||||
fb_page = current_account.facebook_pages.find_by(page_id: fb_page_id)
|
||||
if fb_page
|
||||
fb_page.update_attributes!(
|
||||
fb_page.update!(
|
||||
user_access_token: @user_access_token,
|
||||
page_access_token: page_detail['access_token']
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ class Api::V1::CannedResponsesController < Api::BaseController
|
||||
end
|
||||
|
||||
def update
|
||||
@canned_response.update_attributes!(canned_response_params)
|
||||
@canned_response.update!(canned_response_params)
|
||||
render json: @canned_response
|
||||
end
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class Api::V1::ContactsController < Api::BaseController
|
||||
end
|
||||
|
||||
def update
|
||||
@contact.update_attributes!(contact_params)
|
||||
@contact.update!(contact_params)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
22
app/controllers/api/v1/profiles_controller.rb
Normal file
22
app/controllers/api/v1/profiles_controller.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class Api::V1::ProfilesController < Api::BaseController
|
||||
before_action :fetch_user
|
||||
|
||||
def show
|
||||
render json: @user
|
||||
end
|
||||
|
||||
def update
|
||||
@user.update!(profile_params)
|
||||
render json: @user
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def fetch_user
|
||||
@user = current_user
|
||||
end
|
||||
|
||||
def profile_params
|
||||
params.require(:profile).permit(:email, :name, :password, :password_confirmation, :avatar)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user