Displaying 1 result from an estimated 1 matches for "unit_type_id".
2012 May 13
2
multiple arguments to select
I read in the Rails 3 Way book that when using select(), you can, in
addition to adding calculated columns (i.g. using sql aggregate
functions), include additional attributes in resulting object by
passing the wild card like this:
Unit.select(:*,"sum(unit_type_id) as
total").group("created_at").having(["created_at > ?", 2.days.ago])
That should give you the new method "total" in addition to the default
attributes of the object. However, when I do it, I get this:
ArgumentError: wrong number of arguments (2 for 1)
It...