mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:51:07 +08:00
Allow us to extend serializers easily in a plugin
This commit is contained in:
@ -37,6 +37,13 @@ class Plugin::Instance
|
||||
metadata.name
|
||||
end
|
||||
|
||||
def add_to_serializer(serializer, attr, &block)
|
||||
klass = "#{serializer.to_s.classify}Serializer".constantize
|
||||
|
||||
klass.attributes(attr)
|
||||
klass.send(:define_method, attr, &block)
|
||||
end
|
||||
|
||||
# will make sure all the assets this plugin needs are registered
|
||||
def generate_automatic_assets!
|
||||
paths = []
|
||||
|
Reference in New Issue
Block a user