Class: Ishapi::UserProfilesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Ishapi::UserProfilesController
- Defined in:
- app/controllers/ishapi/user_profiles_controller.rb
Instance Method Summary collapse
-
#check_profile ⇒ Object
@TODO: hmmm I may not need this check at all.
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
#exception, #home, #long_term_token, #vote
Instance Method Details
#check_profile ⇒ Object
@TODO: hmmm I may not need this check at all
5 |
# File 'app/controllers/ishapi/user_profiles_controller.rb', line 5 before_action :check_profile, only: %i| show | |
#show ⇒ Object
9 10 11 12 |
# File 'app/controllers/ishapi/user_profiles_controller.rb', line 9 def show @profile = Ish::UserProfile.find_by :username => params[:username] :show, @profile end |
#update ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/ishapi/user_profiles_controller.rb', line 14 def update @profile = Ish::UserProfile.find @current_user.profile :update, @profile flag = @profile.update params[:profile].permit! if flag render json: { message: 'ok' }, status: :ok else render json: { message: "No luck: #{@profile.errors..join(", ")}." }, code: 400 end end |