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

Fix casting of values #7

Merged
merged 1 commit into from
Aug 18, 2015
Merged

Fix casting of values #7

merged 1 commit into from
Aug 18, 2015

Conversation

rf-
Copy link
Contributor

@rf- rf- commented Aug 17, 2015

We were getting by with just calling connection.quote on values to be
inserted, which isn't sufficient for some kinds of columns (e.g.,
serialized ones).

it 'encodes serialized fields correctly' do
recipe = AR::Recipe.create(title: 'Polenta', metadata: { quality: 'ok' })
recipe_to_sql = Polo::SqlTranslator.new(recipe).to_sql.first
expect(recipe_to_sql).to include(%q{'{"quality":"ok"}'}) # JSON, not YAML
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome

@nettofarah
Copy link
Contributor

This is awesome!
The only suggestion I have is that we isolate the AR specific code in two different modules and include them in runtime.

We were getting by with just calling `connection.quote` on values to be
inserted, which isn't sufficient for some kinds of columns (e.g.,
serialized ones).
@nettofarah
Copy link
Contributor

👍 Thank you so much!

nettofarah added a commit that referenced this pull request Aug 18, 2015
@nettofarah nettofarah merged commit b36a7c5 into master Aug 18, 2015
@nettofarah nettofarah deleted the cast-values branch August 18, 2015 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants