Skip to content

Commit bb64666

Browse files
committed
Merge pull request #152 from wurma/patch-1
Fixed 'No entities found' error when using filter
2 parents 9cf8935 + 649056f commit bb64666

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/rails_erd/diagram.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ def callbacks
150150

151151
def filtered_entities
152152
@domain.entities.reject { |entity|
153-
options.exclude && entity.model && [options.exclude].flatten.include?(entity.name.to_s) or
154-
options.only && entity.model && ![options.only].flatten.include?(entity.name.to_s) or
153+
options.exclude && entity.model && [options.exclude].flatten.include?(entity.name.to_sym) or
154+
options.only && entity.model && ![options.only].flatten.include?(entity.name.to_sym) or
155155
!options.inheritance && entity.specialized? or
156156
!options.polymorphism && entity.generalized? or
157157
!options.disconnected && entity.disconnected?

test/unit/diagram_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,27 +126,27 @@ def calls
126126
test "generate should filter excluded entity" do
127127
create_model "Book"
128128
create_model "Author"
129-
assert_equal [Book], retrieve_entities(:exclude => ['Author']).map(&:model)
129+
assert_equal [Book], retrieve_entities(:exclude => [:Author]).map(&:model)
130130
end
131131

132132
test "generate should filter excluded entities" do
133133
create_model "Book"
134134
create_model "Author"
135135
create_model "Editor"
136-
assert_equal [Book], retrieve_entities(:exclude => ['Author', 'Editor']).map(&:model)
136+
assert_equal [Book], retrieve_entities(:exclude => [:Author, :Editor]).map(&:model)
137137
end
138138

139139
test "generate should include only specified entity" do
140140
create_model "Book"
141141
create_model "Author"
142-
assert_equal [Book], retrieve_entities(:only => ['Book']).map(&:model)
142+
assert_equal [Book], retrieve_entities(:only => [:Book]).map(&:model)
143143
end
144144

145145
test "generate should include only specified entities" do
146146
create_model "Book"
147147
create_model "Author"
148148
create_model "Editor"
149-
assert_equal [Author, Editor], retrieve_entities(:only => ['Author', 'Editor']).map(&:model)
149+
assert_equal [Author, Editor], retrieve_entities(:only => [:Author, :Editor]).map(&:model)
150150
end
151151

152152
test "generate should filter disconnected entities if disconnected is false" do

0 commit comments

Comments
 (0)