File tree 3 files changed +7
-6
lines changed
3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -147,11 +147,10 @@ def create
147
147
def update
148
148
save_file if key_params [ :file ]
149
149
respond_to do |format |
150
-
151
150
self . update_wishlist
152
151
153
- if @key . update ( params [ :vault_key ] )
154
- @key . tags = Vault :: Tag . create_from_string ( key_params [ :tags ] )
152
+ if @key . update ( key_params )
153
+ @key . tags = key_params [ :tags ]
155
154
format . html { redirect_to project_keys_path ( @project ) , notice : t ( 'notice.key.update.success' ) }
156
155
else
157
156
format . html { render action : 'edit' }
Original file line number Diff line number Diff line change @@ -4,10 +4,12 @@ module Vault
4
4
5
5
class Vault ::Key < ActiveRecord ::Base
6
6
belongs_to :project
7
- has_and_belongs_to_many :tags
7
+ has_and_belongs_to_many :tags , join_table : 'keys_vault_tags'
8
8
9
9
def tags = ( tags_string )
10
- @tags = Vault ::Tag . create_from_string ( tags_string )
10
+ tag_objects = Vault ::Tag . create_from_string ( tags_string )
11
+ self . tags . clear
12
+ self . tags << tag_objects
11
13
end
12
14
13
15
def encrypt!
Original file line number Diff line number Diff line change 1
1
module Vault
2
2
class Tag < ActiveRecord ::Base
3
3
self . table_name = 'vault_tags'
4
- has_and_belongs_to_many :keys
4
+ has_and_belongs_to_many :keys , join_table : 'keys_vault_tags'
5
5
6
6
validates :name , presence : true , uniqueness : true
7
7
validates :color , presence : true
You can’t perform that action at this time.
0 commit comments