-
Notifications
You must be signed in to change notification settings - Fork 78
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
Does upsert work with postgres :json columns? #60
Comments
I just ran into this too, when trying to update a jsonb column. Got to head out now but will try and dig further later.
|
Did you guys have any luck with this? I'm also struggling with trying to upsert JSON. |
I took a totally different approach in the end but I'd also be interested to know if anyone had come up with anything. |
I did some digging around and indeed it confuses json for Hash in the Postgreslq connection: v.class returns Hash for json data. Edit: ha, I'm moving stuff between databases, and what is stored in a json field in database A, when taken out via ActiveRecord IS an instance of Hash. So for me the simple solution is to call .to_json on it when inserting into the other db. Not very helpful sorry... |
Even
|
This gem has very slow perfomance for me... Snippets from rails logs
I am moving to raw-sql, bye bye! |
Any fixes yet? |
hi, unfortunately |
Are you open to a PR for json? |
@Ch4s3 definitely! |
I'll take a look with my team next week |
Temporary solution: Mode.upsert(name: 'John', settings: {ip: '192.168.0.1'}.to_json) I hope this helps. |
Yeah, I'm doing something like that. |
@Ch4s3 Have you been working on a PR for json? If not I'll take a look at this one because I'm sure we'll be using it in the near future :) |
(we should do |
@seamusabshere |
(you mean selector fields?) we should probably just disallow it in the selectors. |
@seamusabshere Yes, that's what I meant :) That'd probably be the best. |
@pnomolos I never got around to this unfortunately. I've been using |
Hey tried to batch upsert documents with json fields. I get an error for
PgHstore
so I'm guessing it thinks the hashes are supposed to be:hstore
and not:json
.Is there a setting to have it assume
:json
instead?The text was updated successfully, but these errors were encountered: