-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I was using perry to model a query like select distinct table_name.* from..., but perry explicitly ignored by select statement. Why is this? I know there are possibly better ways to model this query (like using group by and having clauses), but it still seems like it should be supported.
> Model.select('distinct models.*').to_hash
=> {}
Instead, I would expect to see
> Model.select('distinct models.*').to_hash
=> {:select => 'models.*'}
The relevant code is in Perry::Relation#to_hash. The omission seems intentional, but the reasoning behind it escapes me.
# TRP: If one of the select options contains a * than select options are ignored
if select_values && !select_values.empty? && !select_values.any? { |val| val.to_s.match(/\*$/) }
value = call_procs(select_values)
hash.merge!(:select => value.uniq)
endReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels