# Undeclared attribute type for enum 'chat\_send\_shortcut' in UserOption

**URL:** https://meta.discourse.org/t/undeclared-attribute-type-for-enum-chat-send-shortcut-in-useroption/352308
**Category:** Development
**Created:** [February 14, 2025, 3:42pm UTC](https://meta.discourse.org/t/undeclared-attribute-type-for-enum-chat-send-shortcut-in-useroption/352308 "2025-02-14T15:42:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [February 14, 2025, 3:42pm UTC](https://meta.discourse.org/t/undeclared-attribute-type-for-enum-chat-send-shortcut-in-useroption/352308/1 "2025-02-14T15:42:10Z")

</div>

I was trying to run rspec on plugins, and this is what I got:

 ![The image displays an error message from a Ruby on Rails application during gem loading, related to undefined attributes on 'rake plugin' and missing examples in the 'rails_helper'.rb file. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/6/8/a/68afb3281f418ffa57dddcd8033db727ee9b5fd9.png)

It seems to be introduced here:

[https://github.com/discourse/discourse/commit/2cff8c82e36e584346040200a2bcc3192bb3b9ad#diff-9b2a0802874dc8d1bbba919910474ed1b5f0bc2e47b71e69f7aae1d43181eb60](https://github.com/discourse/discourse/commit/2cff8c82e36e584346040200a2bcc3192bb3b9ad#diff-9b2a0802874dc8d1bbba919910474ed1b5f0bc2e47b71e69f7aae1d43181eb60)

> <https://github.com/discourse/discourse/blob/main/plugins/chat/lib/chat/user_option_extension.rb#L53-L55>

It might miss `base.attribute :chat_send_shortcut, :integer, default: 0`?

---

<div class="post-metadata">

### Author: ![dsims](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dsims/32/485916_2.png) [@dsims](https://meta.discourse.org/u/dsims)
#### Post date: [March 11, 2025, 6:32pm UTC](https://meta.discourse.org/t/undeclared-attribute-type-for-enum-chat-send-shortcut-in-useroption/352308/2 "2025-03-11T18:32:42Z")

</div>

I ran into this same issue adding a new enum. Turns out I had to explicitly run the plugin migrations for the test environment:  
`RAILS_ENV=test LOAD_PLUGINS=1 bin/rails db:migrate`

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [March 11, 2025, 6:49pm UTC](https://meta.discourse.org/t/undeclared-attribute-type-for-enum-chat-send-shortcut-in-useroption/352308/3 "2025-03-11T18:49:11Z")

</div>

> [@dsims](#):
>
> RAILS\_ENV=test LOAD\_PLUGINS=1 bin/rails db:migrate

Oh, interesting. I thought `db:migrate` would include the plugins by default.  
Indeed, I had quite a few migrations awaiting for the plugins on `RAILS_ENV=test`.  
The error is gone now, thanks!

EDIT:

Actually, if you use `RAILS_ENV=test bin/rake db:migrate`, notice the “bin/”, it does set the `LOAD_PLUGINS` to 1.

![image](https://global.discourse-cdn.com/meta/optimized/4X/7/3/e/73ed8033123605da2530685585d8c51ece178f20_2_690x54.png)

You can see the content of bin/rake:

```bash
if ENV['RAILS_ENV'] == 'test' && ENV['LOAD_PLUGINS'].nil?
  if ARGV.include?('db:migrate') || ARGV.include?('parallel:migrate')
    STDERR.puts "You are attempting to run migrations in your test environment and are not loading plugins, setting LOAD_PLUGINS to 1"
    ENV['LOAD_PLUGINS'] = '1'
  end
end

```

At some point I’ve probably stopped typing bin/ out of laziness 😄.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [April 10, 2025, 6:49pm UTC](https://meta.discourse.org/t/undeclared-attribute-type-for-enum-chat-send-shortcut-in-useroption/352308/4 "2025-04-10T18:49:29Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
