lib/restpack_serializer/serializable.rb in restpack_serializer-0.2.12 vs lib/restpack_serializer/serializable.rb in restpack_serializer-0.2.13

- old
+ new

@@ -59,27 +59,20 @@ def include_attribute?(name) self.send("include_#{name}?".to_sym) end module ClassMethods + attr_accessor :model_class, :key def as_json(model, context = {}) new.as_json(model, context) end - def set_model_class(klass) - @model_class_name = klass.to_s - end - - def model_class_name - @model_class_name || self.name.chomp('Serializer') - end - def model_class - model_class_name.constantize + @model_class || self.name.chomp('Serializer').constantize end def key - self.model_class.send(:table_name).to_sym + (@key || self.model_class.send(:table_name)).to_sym end end end end