I'm fairly new to Rails but have a fairly extensive programming background. I'm working on a project and my partner told me to call this function:
UserStats.select("DISTINCT(car_id) as car_id").where(["age |~ >?", 25]).map(&:car_id)
He told me this statement will get me an array user car id's for all users over 25.
Now I'm not really sure I fully understand what's going on in this line. I know the UserStats is a class but I don't see a select method.
Is that an already defined method? Can I just call this line in a ruby function or do I need to initialize the class first?
Does the
car_id
need to actually be `:car_id"? Any help would be greatly appreciated.