Module: RestPack::Serializer
- Extended by:
- ActiveSupport::Concern
- Includes:
- Attributes, Paging, Resource, SideLoading
- Defined in:
- lib/restpack_serializer/version.rb,
lib/restpack_serializer/serializable.rb,
lib/restpack_serializer/options.rb
Defined Under Namespace
Modules: Attributes, ClassMethods, Paging, Resource, SideLoading Classes: Factory, InvalidInclude, Options
Constant Summary collapse
- VERSION =
'0.2.4'
Instance Method Summary collapse
Instance Method Details
#as_json(model, options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/restpack_serializer/serializable.rb', line 19 def as_json(model, = {}) @model, @options = model, data = {} if self.class.serializable_attributes.present? self.class.serializable_attributes.each do |key, name| data[key] = self.send(name) if include_attribute?(name) end end add_links(model, data) data end |