Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark/neoid with json field support #28

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Mark/neoid with json field support #28

wants to merge 10 commits into from

Conversation

exklamationmark
Copy link

I was working on an application that runs dual db: PostgreSQL 9.2 and Neo4j, where a model have a json-type field. This wasn't able translatable using the original neoidable config.

So I wrote added a json_field definition that allows json-type fields to be used in Neoid. Basically this will add the content of the json_field to neo4j node.

A drawback is that I can't test this on sqlite3 in-memory db, so I have to create a local postgres db to test. I am open to suggestions on this, though

@glsignal
Copy link

Perhaps something like this could be extracted into, say, a neoid-postgresql module or similar?
It seems, at this point, to be driver-specific enough to warrant such an approach.

What are your thoughts?

@exklamationmark
Copy link
Author

I agree. Not a lot people would be using json field in their db yet. Let me
give it a try.

@exklamationmark
Copy link
Author

@glsignal : hi Greg, so If I want to override the to_neo function in model_additions.rb in a module, what should I do? Right now, Should I rewrite the whole function (including the original conversion), or is there a way for me to inject that particular section of my code ?

@glsignal
Copy link

I suppose that depends on whether the additions can cope with (or be adapted to) being run either before or after the original method, in which case you could just call super.

I'm about to board a flight, but can probably look at it a little more and give you a better answer later on. Rewriting the original and adding additional code will prevent it from getting updates from neoid, should that method be updated in some future revision.

Edit: forget the super approach; http://stackoverflow.com/questions/4470108/when-monkey-patching-a-method-can-you-call-the-overridden-method-from-the-new-i

@glsignal
Copy link

@exklamationmark Sorry my availability to help out on this has dropped to nil I'm afraid :(

@exklamationmark
Copy link
Author

No worry. I think I get the idea.
I seems unlikely that I can modify my current code to run before / after
the original, so I will be overriding the whole function.

Thanks for your help, Greg

Best regards,
Tong Huu Khiem (Mark), (Mr.)
Computer Engineering student - National University of Singapore
Email: [email protected] | Phone: (+65)-84096274 | Website:
portfolio.my-ideas-lab.net

On Mon, Sep 16, 2013 at 7:08 PM, Greg Signal [email protected]:

@exklamationmark https://github.com/exklamationmark Sorry my
availability to help out on this has dropped to nil I'm afraid :(


Reply to this email directly or view it on GitHubhttps://github.com/elado/neoid/pull/28#issuecomment-24502668
.

@BenMorganIO
Copy link
Contributor

No PRs are currently being merged until tests are passing again on Travis.

Apologies, but I will review and implement after I have stabilized Neoid for version 0.2.0.

@BenMorganIO
Copy link
Contributor

PRs are now being accepted. @exklamationmark if you could rebase, I will look into getting this feature in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants