我最近从ruby 2.5.1 to 2.6.3
和rails 5.0.7.2 to 5.2.3
更新了我的应用
我的用户控制器的更新方法遇到问题。
我得到了undefined method 'delete_if' for #<String:0x00007fac73d38c78> Did you mean? delete delete!
# PATCH/PUT /users/:id
def update
if @user.update(user_params)
redirect_to company_users_path(@user.company), notice: 'User was successfully updated.'
else
render :edit
end
end
编辑这是我的用户模型
class User < ApplicationRecord
paginates_per 10
extend Enumerize
has_many :user_challenges, dependent: :destroy
has_many :challenges, through: :user_challenges
has_many :user_events, dependent: :destroy
has_many :events, through: :user_events
has_and_belongs_to_many :objectives
has_one :binome_as_invited, class_name: 'Binome', foreign_key: 'invited_user_id', dependent: :destroy
has_one :binome_as_inviting, class_name: 'Binome', foreign_key: 'inviting_user_id', dependent: :destroy
belongs_to :company, optional: true
has_many :actions, dependent: :destroy
has_many :hello_messages, foreign_key: 'target_id'
has_many :custom_challenges, foreign_key: 'target_id'
has_many :sent_challenges, class_name: 'CustomChallenge', foreign_key: 'author_id'
has_many :received_challenges, class_name: "CustomChallenge", foreign_key: "target_id"
has_many :sent_challenges, class_name: "CustomChallenge", foreign_key: "author_id"
has_many :binome_invitations, foreign_key: "invited_user_id"
has_many :device_tokens
delegate :challenges, to: :company, prefix: true
acts_as_paranoid
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
include DeviseTokenAuth::Concerns::User
attr_accessor :secret_code
validate :company_code, on: :create
validates :first_name, :last_name, :phone, :age, :ki_count, presence: true
ROLES = ['admin', 'company_admin', 'user', 'inactive']
enumerize :role, in: ROLES
scope :with_avatar, -> { where.not(avatar: 0) }
是不是act_as_paranoid宝石?还是我需要更新的宝石?肯定是因为我更新了rails或ruby或单个gem。
EDIT2 堆栈跟踪的最后一项似乎链接到gem devise_token_auth
devise_token_auth (1.1.0) app/models/devise_token_auth/concerns/user.rb:218:in `destroy_expired_tokens'