1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-05 16:24:21 +01:00
fab-manager/app/views/api/categories/index.json.jbuilder

7 lines
193 B
Ruby

user_is_admin = (current_user and current_user.admin?)
json.array!(@categories) do |category|
json.extract! category, :id, :name
json.related_to category.events.count if user_is_admin
end