simply_stored
simply_stored copied to clipboard
uninitialized constant when using custom has_many association
Taking the example from the fixtures file in the simply_stored tests for User and Document.
When doing a_user.add_doc a_document, we get a 'NameError: uninitialized constant Doc'
Because in https://github.com/peritor/simply_stored/blob/master/lib/simply_stored/couch/has_many.rb#L61 we call simply_stored/class_methods_base.rb:5:in `get_class_from_name'" and then we are passing in 'docs' instead of the custom specified :class_name of Document.
So when defining the setter for has_many, it thinks that the class name is Doc instead of Document.
Here's a console output of this issue: https://gist.github.com/1304852
made a pull request for a fix: https://github.com/peritor/simply_stored/pull/19