User profile param fix

This commit is contained in:
Ari Timonen 2020-03-18 22:03:56 +02:00
parent 25761db2f3
commit f51af16ca2
3 changed files with 35 additions and 31 deletions

View file

@ -53,7 +53,8 @@ class Issue < ActiveRecord::Base
before_validation :init_variables, :if => Proc.new{|issue| issue.new_record?}
before_save :parse_text
after_save :remove_readings
# FIXME
# after_save :remove_readings
acts_as_readable

View file

@ -355,6 +355,9 @@ class User < ActiveRecord::Base
end
def self.params(params, cuser)
params.require(:user).permit(:raw_password, :firstname, :lastname, :email, :steamid, :country, :birthdate, :timezone, :public_email, :filter, :team_id)
profile_attrs = cuser.profile.attributes.keys - ["id", "created_at", "updated_at"]
allowed = [:raw_password, :firstname, :lastname, :email, :steamid, :country, :birthdate, :timezone, :public_email, :filter, :time_zone, :team_id, profile_attributes: [profile_attrs]]
allowed << :username if cuser.admin?
params.require(:user).permit(*allowed)
end
end