Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dubious SQL used to find active rows #8

Open
dkirkby opened this issue Jul 1, 2010 · 3 comments
Open

Dubious SQL used to find active rows #8

dkirkby opened this issue Jul 1, 2010 · 3 comments
Labels

Comments

@dkirkby
Copy link
Owner

dkirkby commented Jul 1, 2010

I am using find(:all,:group=>'networkID',...) in several places and expecting that it returns all fields of the most recent (in the max(ID) sense) row for each distinct networkID. For some reason, this is working fine, at least with sqlLite, but I don't understand why since the corresponding query appears to be:

SELECT * FROM "device_configs" GROUP BY serialNumber ...

How does "SELECT *" work with GROUP BY? Need to check that this still works with mySQL...

Controller actions where this occurs: athome/index, config/active, lam/active. Also in the device_config model validation active_configs_are_unique.

@dkirkby
Copy link
Owner Author

dkirkby commented Jul 15, 2010

The active_configs_are_unique validation is working ok now that it uses an initial query to get the list of active serial numbers first. This could probably be refactorized but is not broken.

@dkirkby
Copy link
Owner Author

dkirkby commented Jul 17, 2010

config/active renamed to config/index and is now fixed. lam/active and athome/index still need work.

@dkirkby
Copy link
Owner Author

dkirkby commented Jul 31, 2010

athome/index has been reworked now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant