I've added a couple of lines into the Readme to explain how to select multiple attributes #264

Merged
merged 2 commits into from Aug 2, 2013

Projects

None yet

4 participants

@peternixey
Contributor

It took me a little while to figure out how to select multiple attributes in a query. I've added little paragraph in which details this

@peternixey peternixey Added instructions for how to select multiple attributes in Squeel
It took me a little while to figure out how to select multiple attributes in a query. I've added little paragraph in which details this
417f008
@the8472
the8472 commented Aug 1, 2013

btw, passing an array of keypaths works too .select{[foo,bar]}

@ernie
Member
ernie commented Aug 1, 2013

You can use an array, which is the recommended course of action.

Sent from my iPhone

On Aug 1, 2013, at 2:58 AM, peternixey notifications@github.com wrote:

It took me a little while to figure out how to select multiple attributes

in a query. I've added little paragraph in which details this

You can merge this Pull Request by running

git pull https://github.com/peternixey/squeel master

Or view, comment on, or merge it at:

#264
Commit Summary

  • Added instructions for how to select multiple attributes in Squeel

File Changes

Patch Links:

@peternixey
Contributor

Thank you - I didn't realise that - have updated it.

@ernie ernie merged commit 20eb0fa into activerecord-hackery:master Aug 2, 2013

1 check passed

default The Travis CI build passed
Details
@ebinmore

@peternixey Why would you not just use:
p = Person.select{[name.op('||', '-diddly').as(flanderized_name), coalesce(name, '').as(name_with_default)]}.first

Would this not accomplish the same thing you are trying to do? As separate scopes, it is possible to chain them, but I'm not sure what this example offers.

@ebinmore

Sorry resolved almost 3 weeks ago... :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment