diff options
author | Starfall <us@starfall.systems> | 2021-02-26 22:07:00 -0600 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2021-02-26 22:07:00 -0600 |
commit | 033b1b5b900babc9b068ddad0ae644c5f15e9ffe (patch) | |
tree | 76a4d5f8890836e855cccdf4ad7d58fd9c0159ee /app/serializers | |
parent | 35f9f9565e142b8c8e7541549046bad679f1438d (diff) | |
parent | 4aa860b65bd796b09dc0ceffa1fdd7de31060a34 (diff) |
Merge remote-tracking branch 'glitchsoc/main' into main
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/rest/instance_serializer.rb | 4 | ||||
-rw-r--r-- | app/serializers/rest/rule_serializer.rb | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb index 54e7c450c..ae8b80fb7 100644 --- a/app/serializers/rest/instance_serializer.rb +++ b/app/serializers/rest/instance_serializer.rb @@ -9,7 +9,9 @@ class REST::InstanceSerializer < ActiveModel::Serializer has_one :contact_account, serializer: REST::AccountSerializer - delegate :contact_account, to: :instance_presenter + has_many :rules, serializer: REST::RuleSerializer + + delegate :contact_account, :rules, to: :instance_presenter def uri Rails.configuration.x.local_domain diff --git a/app/serializers/rest/rule_serializer.rb b/app/serializers/rest/rule_serializer.rb new file mode 100644 index 000000000..fc925925a --- /dev/null +++ b/app/serializers/rest/rule_serializer.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class REST::RuleSerializer < ActiveModel::Serializer + attributes :id, :text + + def id + object.id.to_s + end +end |