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

Sort Key for HABTM should be comma seperated string instead of Array #115

Closed
wants to merge 1 commit into from

Conversation

mark579
Copy link

@mark579 mark579 commented May 8, 2017

This was creating issues doing a dump because Arel Table expects a string for the order argument and was receiving an Array.

@mark579
Copy link
Author

mark579 commented May 8, 2017

Build Failures don't appear to be related to the code.

@mark579
Copy link
Author

mark579 commented May 19, 2017

Any thoughts on getting this merged?

dnrce added a commit to dnrce/yaml_db that referenced this pull request May 21, 2017
dnrce added a commit to dnrce/yaml_db that referenced this pull request May 21, 2017
dnrce added a commit to dnrce/yaml_db that referenced this pull request May 21, 2017
Now always generate an array to be a bit clearer, but splat it when used.

Fixes yamldb#115
@dnrce
Copy link
Member

dnrce commented May 21, 2017

Thanks for raising this! Arel accepts multiple arguments to order, but they need to be provided separately rather than in an Array.

OK:

2.3.1 :002 > Arel::Table.new('normal_table').order('id').orders
 => ["id"]

Not OK:

2.3.1 :003 > Arel::Table.new('habtm_table').order(['first_id', 'second_id']).orders
 => [["first_id", "second_id"]]

Fixed:

2.3.1 :004 > Arel::Table.new('habtm_table').order(*['first_id', 'second_id']).orders
 => ["first_id", "second_id"]

I've corrected this in #119.

@dnrce dnrce closed this in #119 May 21, 2017
dnrce added a commit that referenced this pull request May 21, 2017
Now always generate an array to be a bit clearer, but splat it when used.

Fixes #115
@mark579
Copy link
Author

mark579 commented May 21, 2017

Nice! Thank you.

heyogrady pushed a commit to heyogrady/yaml_db that referenced this pull request Jan 11, 2019
Now always generate an array to be a bit clearer, but splat it when used.

Fixes yamldb#115
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