I am trying to update a hash that is being made when a csv is uploaded by a user, so that it saves the added key/value pair to the db.
How can I update the hash being made in the create_by_location method with the method check_enable_recordings
user model
before_save :check_enable_recordings
def check_enable_recordings
x = tenant.enable_recording_extensions
Rails.logger.debug("check if true #{x}" )
if x
user = User.new(
recorded: "1"
)
end
end
def self.create_by_location(location,hash)
user = User.new(
first_name: hash[:firstname],
last_name: hash[:lastname],
email: hash[:email],
)
end
userhash with thecheck_enable_recrodingsmethod so that it saves into the dbcheckmethod is defined where? If it's inUserthen you shouldn't be creating a new user, you should be doingself.recorded = "1".User model, I didn't even realize that it was that simple of a fix. Thank You! if you put it as the answer below I will mark it correct