lib/restpack_serializer/serializable.rb in restpack_serializer-0.2.10 vs lib/restpack_serializer/serializable.rb in restpack_serializer-0.2.11

- old
+ new

@@ -63,15 +63,19 @@ module ClassMethods def as_json(model, context = {}) new.as_json(model, context) end - def model_name - self.name.chomp('Serializer') + 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_name.constantize + model_class_name.constantize end def key self.model_class.send(:table_name).to_sym end