dingbat/nsrails — pull request #37 by marklarr (2013-06-07 05:40:56+00:00)
Title: Autogen for mongoid projects

What is this?
----------
This will allow usage of the `generate` script on a mongoid project by parsing the model files for schema information rather than `schema.rb`.

Testing
----------
1. Clone https://github.com/jenius/Locomotive-Testing
2. Run the `generate` script on the cloned code.
3. Look at the generated files -- the imports, properties, synthesizes, and relations should all have been written.

What's next?
----------------
Mongoid uses GUID (alphanumeric), unfortunately, whereas NSRails expects `remoteID` to be numeric (property is set as an `NSNumber*`). We could simply refactor the code to make `remoteID` an `NSString*`, but this would cause some pain for existing users who expect it to be an `NSNumber*`. Maybe it could just return an `id`, being either `NSNumber*` or `NSString*` if it's from a non-mongo or mongo setup, respectively?

For me, I simply sublasses NSRemoteObject, changed `remoteID` to an `NSString*`, and then categoried `NSString*` to add the method `stringValue` -- this seems to be good enough for NSRails to do its thing.

Awesome work on NSRails. I'm loving it.