Project

General

Profile

How does "find" of class User work?

Added by Nino Schubert over 8 years ago

Hello everyone!

Im currently trying to understand how Redmine is working and I could not find anything on the following problem:

If I use

users << User.find(:first, :conditions => {:users => {:id => row[0]}}, :order => "lastname, firstname" )

Redmine is creating queries like the following

SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = 23 ORDER BY lastname, firstname LIMIT 1

Where does the

`users`.`type` IN ('User', 'AnonymousUser')

part come from? Is it possible to overwrite/configure the standard behaviour?

I am using a quite old version of redmine as "playground" (redmine 2.3.0, ruby 1.9.3, rails 3.2.13) but maybe it is possible to point me in the right direction nonetheless?

Thanks a lot

Nino