ruby - How do I get MIN in Postgres to play nice with Rails? -


Right now, I have a very big query that I am running in the rail:

  @foo_collection = Foo.select some_aggregate in the form of 'foos.id, array_agg () - 20 of these, but they are not issues MIN (bars.some_date), - Returning the wrong type - this is the problem'). Jones ('inner join bars ... - there is a lot - but there is no problem'). Where ('some_conditions'). Group ('foos.id')  

This query pulls the data I want according to PGAdmin. I do not have the rail is well translated. Trying to create a time difference result as an DateTime object as @ foo_collection.some_date :

  is undefined To give the railway a  date time  to my PG output Is there any way to coax  string , or do I have to tell the rail to purse all  some_date  s as  string  s? 

So far, the railroad has changed all @ foo_collection.some_date s to_datetime , then to_f It has managed so that I can make a mistake in the time between them. But there is a lot of overhead - if I can withdraw the datetime object directly from DB, then it will be very easy.

The tracks are likely to pull the fields as a string because you have a fixed column type Models are not querying, I think your best bet could be to convert query to output table and use a rail model to query that table.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -