Allow us to extend serializers easily in a plugin
This commit is contained in:
parent
645a22fdd5
commit
4748b21c56
|
@ -37,6 +37,13 @@ class Plugin::Instance
|
||||||
metadata.name
|
metadata.name
|
||||||
end
|
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
|
# will make sure all the assets this plugin needs are registered
|
||||||
def generate_automatic_assets!
|
def generate_automatic_assets!
|
||||||
paths = []
|
paths = []
|
||||||
|
|
Loading…
Reference in New Issue