# 플러그인에 vault-rails 게姆 추가 시 문제 발생

**URL:** <https://meta.discourse.org/t/trouble-adding-vault-rails-gem-to-a-plugin/173291>\
**Category:** Development\
**Created:** [12월 14, 2020, 8:53오후 UTC](https://meta.discourse.org/t/trouble-adding-vault-rails-gem-to-a-plugin/173291 "2020-12-14T20:53:49Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [12월 14, 2020, 8:53오후 UTC](https://meta.discourse.org/t/trouble-adding-vault-rails-gem-to-a-plugin/173291/1 "2020-12-14T20:53:49Z")

</div>

`vault-rails`를 플러그인에 추가하여 내가 추가한 모델의 일부인 키를 암호화하려고 합니다. 이 예제를 따르고 있습니다: [Plugin with custom gems - #4 by Falco](https://meta.discourse.org/t/plugin-with-custom-gems/57190/4?u=pfaffman)

(이미 Discourse에서 이렇게 할 수 있는 방법이 있는데 제가 못 찾은 건가요? encrypt 플러그인만 보이는데…)

이 줄을 `plugin.rb`에 넣으면 `Could not find 'rails' (>= 5.0) among 348 total gem(s)` 오류가 발생합니다. 같은 줄을 Discourse의 `Gemfile`에 추가하면 정상적으로 작동합니다.

```
gem "vault-rails", "0.7.0", { require: false }

```

```plaintext
 (master *) pfaffman@shinytim:~/src/discourse-repos/discourse$ ./bin/rails c
Traceback (most recent call last):
	43: from ./bin/rails:17:in `<main>'
	42: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `require'
	41: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:291:in `load_dependency'
	40: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `block in require'
	39: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
	38: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
	37: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	36: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
	35: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
	34: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/commands.rb:18:in `<main>'
	33: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/command.rb:46:in `invoke'
	32: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/command/base.rb:69:in `perform'
	31: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
	30: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
	29: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
	28: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/commands/console/console_command.rb:101:in `perform'
	27: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
	26: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/command/actions.rb:22:in `require_application!'
	25: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `require'
	24: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:291:in `load_dependency'
	23: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `block in require'
	22: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
	21: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
	20: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	19: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
	18: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
	17: from /home/pfaffman/src/discourse-repos/discourse/config/application.rb:70:in `<main>'
	16: from /home/pfaffman/src/discourse-repos/discourse/config/application.rb:71:in `<module:Discourse>'
	15: from /home/pfaffman/src/discourse-repos/discourse/config/application.rb:304:in `<class:Application>'
	14: from /home/pfaffman/src/discourse-repos/discourse/lib/plugin_initialization_guard.rb:5:in `plugin_initialization_guard'
	13: from /home/pfaffman/src/discourse-repos/discourse/config/application.rb:305:in `block in <class:Application>'
	12: from lib/discourse.rb:225:in `activate_plugins!'
	11: from lib/discourse.rb:225:in `each'
	10: from lib/discourse.rb:228:in `block in activate_plugins!'
	 9: from /home/pfaffman/src/discourse-repos/discourse/lib/plugin/instance.rb:611:in `activate!'
	 8: from /home/pfaffman/src/discourse-repos/discourse/lib/plugin/instance.rb:611:in `instance_eval'
	 7: from /home/pfaffman/src/discourse-repos/discourse/plugins/discourse-pfaffmanager/plugin.rb:13:in `activate!'
	 6: from /home/pfaffman/src/discourse-repos/discourse/lib/plugin/instance.rb:705:in `gem'
	 5: from /home/pfaffman/src/discourse-repos/discourse/lib/plugin_gem.rb:22:in `load'
	 4: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:1371:in `activate'
	 3: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:1389:in `activate_dependencies'
	 2: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:1389:in `each'
	 1: from /home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:1400:in `block in activate_dependencies'
/home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'rails' (>= 5.0) among 348 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/home/pfaffman/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0:/home/pfaffman/Dropbox/home/bin/dotfiles/.gem/ruby/2.7.0', execute `gem env` for more information

```

---

_[View the full topic](https://meta.discourse.org/t/trouble-adding-vault-rails-gem-to-a-plugin/173291)._
