Skip to content

Commit 30b9f8d

Browse files
committed
Comments
1 parent d024e69 commit 30b9f8d

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

app/models/feature_toggles.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
# Central location to store FeatureToggles
12
class FeatureToggles
23
class << self
3-
def reset_data = true
4+
def reset_data? = true
45
end
56
end

app/views/contexts/show.json.jbuilder

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ json.current_user do
99
end
1010
end
1111

12-
json.feature_flags reset_data_feature: FeatureToggles.reset_data
12+
# We often see feature toggle definitions scattered throughout the codebase.
13+
# They should be put in a central location – here we use FeatureToggles.
14+
json.feature_flags reset_data_feature: FeatureToggles.reset_data?
1315
json.theme "light-mode"
1416
json.locale I18n.locale
1517
json.environment Rails.env

app/views/posts/index.json.jbuilder

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ json.posts do
1515
end
1616
json.highlighted Permissions::Post.can_edit?(current_user, post)
1717
# We send permissions to the server so that
18-
# the client doesn't have to contain authorization logic.
18+
# the client doesn't have to contain any authorization logic.
1919
json.can_edit_post Permissions::Post.can_edit?(current_user, post)
2020
json.created_at post.created_at.iso8601
2121
end
@@ -26,7 +26,7 @@ json.pagination do
2626
json.prev_page @posts.prev_page
2727
end
2828
# We send permissions to the server so that
29-
# the client doesn't have to contain authorization logic.
29+
# the client doesn't have to contain any authorization logic.
3030
json.permissions do
3131
json.can_create_post Permissions::Post.can_create?(current_user)
3232
end

0 commit comments

Comments
 (0)