(Hotfix) Fixes a variety of small bugs (#115)
* Remove ap call * Fix remix render method * Downcase username on db end There was a bug where users with capital letters in their name could not access their profiles after we tried to make things case insensitive. * Remove ap call and unused code
This commit is contained in:
parent
78b5b063fc
commit
13a9644bb0
3 changed files with 4 additions and 18 deletions
|
|
@ -23,19 +23,6 @@ module Api
|
||||||
party.user = current_user if current_user
|
party.user = current_user if current_user
|
||||||
party.attributes = party_params if party_params
|
party.attributes = party_params if party_params
|
||||||
|
|
||||||
# unless party_params.empty?
|
|
||||||
# party.attributes = party_params
|
|
||||||
#
|
|
||||||
# # TODO: Extract this into a different method
|
|
||||||
# job = Job.find(party_params['job_id']) if party_params['job_id'].present?
|
|
||||||
# if job
|
|
||||||
# job_skills = JobSkill.where(job: job.id, main: true)
|
|
||||||
# job_skills.each_with_index do |skill, index|
|
|
||||||
# party["skill#{index}_id"] = skill.id
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
if party.save!
|
if party.save!
|
||||||
return render json: PartyBlueprint.render(party, view: :created, root: :party),
|
return render json: PartyBlueprint.render(party, view: :created, root: :party),
|
||||||
status: :created
|
status: :created
|
||||||
|
|
@ -76,8 +63,8 @@ module Api
|
||||||
new_party.local_id = party_params[:local_id] if !party_params.nil?
|
new_party.local_id = party_params[:local_id] if !party_params.nil?
|
||||||
|
|
||||||
if new_party.save
|
if new_party.save
|
||||||
render json: PartyBlueprint.render(new_party, view: :created, root: :party,
|
render json: PartyBlueprint.render(new_party, view: :created, root: :party),
|
||||||
meta: { remix: true })
|
status: :created
|
||||||
else
|
else
|
||||||
render_validation_error_response(new_party)
|
render_validation_error_response(new_party)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -167,11 +167,11 @@ module Api
|
||||||
|
|
||||||
# Specify whitelisted properties that can be modified.
|
# Specify whitelisted properties that can be modified.
|
||||||
def set
|
def set
|
||||||
@user = User.where('username = ?', params[:id].downcase).first
|
@user = User.find_by('lower(username) = ?', params[:id].downcase)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_by_id
|
def set_by_id
|
||||||
@user = User.where('id = ?', params[:id]).first
|
@user = User.find_by('id = ?', params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_params
|
def user_params
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_hash
|
def to_hash
|
||||||
ap @data
|
|
||||||
{
|
{
|
||||||
message: message,
|
message: message,
|
||||||
code: code,
|
code: code,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue