Sha256: 6888c9cbb899399366955470701977c21848defa8df40b5f90662a8045da2517

Contents?: true

Size: 781 Bytes

Versions: 127

Compression:

Stored size: 781 Bytes

Contents

require_dependency "ishapi/application_controller"
module Ishapi
  class UserProfilesController < ApplicationController

    before_action :check_profile, only: %i| show | ## @TODO: hmmm I may not need this check at all

    before_action :check_profile_hard, only: %i| update |

    def show
      @profile = Ish::UserProfile.find_by :username => params[:username]
      authorize! :show, @profile
    end

    def update
      @profile = Ish::UserProfile.find @current_user.profile
      authorize! :update, @profile

      flag = @profile.update params[:profile].permit!
      if flag
        render json: { message: 'ok' }, status: :ok
      else
        render json: { message: "No luck: #{@profile.errors.full_messages.join(", ")}." }, code: 400
      end
    end

  end
end

Version data entries

127 entries across 127 versions & 1 rubygems

Version Path
ishapi-0.1.8.316 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.315 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.314 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.313 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.312 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.310 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.309 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.308 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.307 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.306 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.305 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.304 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.303 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.302 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.301 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.300 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.298 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.297 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.296 app/controllers/ishapi/user_profiles_controller.rb
ishapi-0.1.8.295 app/controllers/ishapi/user_profiles_controller.rb