We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6847c00 + 4a30663 commit 38d86fbCopy full SHA for 38d86fb
2 files changed
app/models/card/taggable.rb
@@ -9,7 +9,7 @@ module Card::Taggable
9
end
10
11
def toggle_tag_with(title)
12
- tag = Tag.find_or_create_by!(title: title)
+ tag = account.tags.find_or_create_by!(title: title)
13
14
transaction do
15
if tagged_with?(tag)
test/models/card/taggable_test.rb
@@ -16,4 +16,13 @@ class Card::TaggableTest < ActiveSupport::TestCase
16
@card.toggle_tag_with "ruby"
17
18
19
+
20
+ test "scope tags by account" do
21
+ assert_difference -> { Tag.count }, 2 do
22
+ cards(:logo).toggle_tag_with "ruby"
23
+ cards(:paycheck).toggle_tag_with "ruby"
24
+ end
25
26
+ assert_not_equal cards(:logo).tags.last, cards(:paycheck).tags.last
27
28
0 commit comments