プロジェクト

全般

プロフィール

Vote #73251

完了

Usage of attribute_present? in UserPreference

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
30
version_id:
73
issue_org_id:
13008
author_id:
291
assigned_to_id:
1
comments:
2
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
66
ステータス-->[Closed]

説明

Hi,

when I enter @User.new.pref@ in the Rails console, @user_id@ is stored in the @others@ hash.

>> User.new.pref
#nil}, hide_mail: false, time_zone: nil>

Solution: In @UserPreference#[]@ and @UserPreference#[]=@ @attribute_present?@ should be replaced by @has_attribute?@.

The current implementation also works because @UsersController#create@ saves the user before creating the preference, so @attribute_present? :user_id@ returns @true@.

Best regards,
Thomas


journals

--------------------------------------------------------------------------------
Fixed in r12126 with a test, thanks for pointing this out.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリCode cleanup/refactoring_30 にセット
  • 対象バージョン2.3.3_73 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0