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

Extra single quotes in sql #23

Open
Paxa opened this issue Feb 6, 2013 · 1 comment
Open

Extra single quotes in sql #23

Paxa opened this issue Feb 6, 2013 · 1 comment

Comments

@Paxa
Copy link

Paxa commented Feb 6, 2013

Code:

user.roles = (user.roles || []) + [role_name]
user.save

Get:

PG::Error: ERROR:  array value must start with "{" or dimension information
LINE 1: ..._name" = 'Admin', "last_name" = 'Shop', "roles" = '''{"admin...
                                                             ^
: UPDATE "users" SET "encrypted_password" = '$2a$10$cWhCkffLHVGnv9S47nJZr.ycMe.3Gc./rcEqCq7paG1JZ.fhV3y8y', "first_name" = 'Admin', "middle_name" = 'Admin', "last_name" = 'Shop', "roles" = '''{"admin",customer}''', "confirmed_at" = '2013-02-06 08:07:13.428599', "created_at" = '2013-02-06 08:07:13.461182', "updated_at" = '2013-02-06 08:07:13.461182', "unconfirmed_email" = 'admin@example.com' WHERE "users"."id" = 1

Working variant:

user.roles = [] + (user.roles || []) + [role_name]
@tlconnor
Copy link
Owner

Can you please retest against the latest version? I have added a test case for the above and it appears to be working correctly.

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

No branches or pull requests

2 participants