# כיצד אוכל להוסיף מאפיין למודל המשתמש?

**URL:** <https://meta.discourse.org/t/how-can-i-add-an-attribute-to-user-model/237348>\
**Category:** Development\
**Created:** [27 באוגוסט,‏ 2022,‏ 5:27pm UTC](https://meta.discourse.org/t/how-can-i-add-an-attribute-to-user-model/237348 "2022-08-27T17:27:48Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Alienazk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alienazk/32/261130_2.png) [@Alienazk](https://meta.discourse.org/u/Alienazk)\
**Post date:** [27 באוגוסט,‏ 2022,‏ 6:41pm UTC](https://meta.discourse.org/t/how-can-i-add-an-attribute-to-user-model/237348/4 "2022-08-27T18:41:06Z")

</div>

I change

```plaintext
add_to_class(:user, :total_earned_points) do
    # self.user_points.sum(:reward_points)
    self.total_point[:total_earned_points]
end

```

to

```plaintext
add_to_class(:user, :total_earned_points) do
    # self.user_points.sum(:reward_points)
    self.total_point.read_attribute(:total_earned_points)
end

```

still doesn’t work. 😰  
Can anyone help me?

---

_[View the full topic](https://meta.discourse.org/t/how-can-i-add-an-attribute-to-user-model/237348)._
