
Select not working?
Reported by Esteban | December 22nd, 2008 @ 09:24 AM
I found something it's not working (or maybe i'm doing it wrong)
The controller:
@search = PerformanceLog.new_search(params[:search]) @search.select
= 'url, server, MIN(tiempo) AS minimo, MAX(tiempo) AS maximo,
AVG(tiempo) AS promedio, COUNT(*) AS apariciones' @search.group =
'url, server' @search.order = 'COUNT(*) DESC'
@search.conditions.case_log.suite_log.environment ||= "PRODUCCION"
@search.per_page = nil @perf_logs = @search.all
and i get this query :
SELECT performance_logs
.* FROM
performance_logs
LEFT OUTER JOIN
case_logs
ON case_logs
.id =
performance_logs
.case_log_id LEFT OUTER JOIN
suite_logs
ON suite_logs
.id =
case_logs.suite_log_id WHERE
(
suite_logs.
environment` = 'PRODUCCION') GROUP
BY url, server ORDER BY COUNT(*) DESC
The conditions, gruoping and ordering are ok, but I can't get the columns I want.
Using
User.find(:all, :select => 'url, server, MIN(tiempo) AS minimo,
MAX(tiempo) AS maximo, AVG(tiempo) AS promedio, COUNT(*) AS
apariciones')
It gets the attributes I want, but I can't use the searchlogic conditions.
Is there anyway to fix this?
I'm using MySQL database in a debian machine and the Rails app is hosted in a Windows machine (I'm going to migrate it soon to a linux box :) )
Ruby 1.8.6 patchlevel 111
Rails 2.2.2
Searchlogic 1.6.2
Comments and changes to this ticket
-
Ben Johnson December 27th, 2008 @ 12:34 PM
- State changed from new to resolved
I believe this is fixed, please update to the latest searchlogic and let me know if you still have problems.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Provides common named scopes and object based searching.