8000 Merge pull request #5895 from activeadmin/meta_tags_and_tag_conflict · activeadmin/activeadmin@8ecfc77 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8ecfc77

Browse files
authored
Merge pull request #5895 from activeadmin/meta_tags_and_tag_conflict
Fix conflict between meta tags and `Tag` models
2 parents 5bab881 + 2dac2b3 commit 8ecfc77

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
* Use filter label when condition has a predicate. [#5886] by [@ko-lem]
88
* Fix error when routing with array containing symbol. [#5870] by [@jwesorick]
9+
* Fix error when there is a model named `Tag` and `meta_tags` have been configured. [#5893] by [@micred], [@FabioRos] and [@deivid-rodriguez]
910

1011
### Removals
1112

@@ -528,6 +529,7 @@ Please check [0-6-stable] for previous changes.
528529
[#5877]: https://github.com/activeadmin/activeadmin/pull/5877
529530
[#5886]: https://github.com/activeadmin/activeadmin/pull/5886
530531
[#5870]: https://github.com/activeadmin/activeadmin/pull/5870
532+
[#5893]: https://github.com/activeadmin/activeadmin/pull/5893
531533

532534
[@5t111111]: https://github.com/5t111111
533535
[@aarek]: https://github.com/aarek
@@ -553,6 +555,7 @@ Please check [0-6-stable] for previous changes.
553555
[@drn]: https://github.com/drn
554556
[@eikes]: https://github.com/eikes
555557
[@f1sherman]: https://github.com/f1sherman
558+
[@FabioRos]: https://github.com/FabioRos
556559
[@faucct]: https://github.com/faucct
557560
[@Fivell]: https://github.com/Fivell
558561
[@glebtv]: https://github.com/glebtv
@@ -578,6 +581,7 @@ Please check [0-6-stable] for previous changes.
578581
[@markstory]: https://github.com/markstory
579582
[@mauriciopasquier]: https://github.com/mauriciopasquier
580583
[@mconiglio]: https://github.com/mconiglio
584+
[@micred]: https://github.com/micred
581585
[@ndbroadbent]: https://github.com/ndbroadbent
582586
[@Nguyenanh]: https://github.com/Nguyenanh
583587
[@panasyuk]: https://github.com/panasyuk

features/meta_tags.feature

Lines changed: 17 additions & 7 deletions
A44C
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,30 @@ Feature: Meta Tag
22

33
Add custom meta tags to head of pages.
44

5-
Background:
5+
Scenario: Logged out views include custom meta tags
66
Given a configuration of:
77
"""
8-
ActiveAdmin.register Post
9-
ActiveAdmin.application.meta_tags = { author: 'My Company' }
108
ActiveAdmin.application.meta_tags_for_logged_out_pages = { robots: 'noindex' }
119
"""
12-
13-
Scenario: Logged out views include custom meta tags
14-
Given I am logged out
10+
And I am logged out
1511
When I am on the login page
1612
Then the site should contain a meta tag with name "robots" and content "noindex"
1713

1814
Scenario: Logged in views include custom meta tags
19-
Given I am logged in
15+
Given a configuration of:
16+
"""
17+
ActiveAdmin.register Post
18+
ActiveAdmin.application.meta_tags = { author: 'My Company' }
19+
"""
20+
And I am logged in
2021
When I am on the dashboard
2122
Then the site should contain a meta tag with name "author" and content "My Company"
23+
24+
Scenario: Meta tags are not confused with a Tag model
25+
Given a show configuration of:
26+
"""
27+
ActiveAdmin.register Tag
28+
ActiveAdmin.application.meta_tags = { author: 'My Company' }
29+
"""
30+
Then I should not see "#<Tag:0x"
31+
And the site should contain a meta tag with name "author" and content "My Company"

lib/active_admin/views/pages/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def build_active_admin_head
3333
end
3434

3535
active_admin_namespace.meta_tags.each do |name, content|
36-
text_node(tag(:meta, name: name, content: content))
36+
text_node(meta(name: name, content: content))
3737
end
3838

3939
active_admin_application.javascripts.each do |path|

0 commit comments

Comments
 (0)
0