27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/lanes/access/track_modifications.rb', line 27
def with_user_logins
q = self; t = table_name
if current_scope.nil? || current_scope.select_values.exclude?("#{t}.*")
q = q.select("#{t}.*")
end
if self.column_names.include?('created_by_id')
q = q.select("created_by_user.login as created_by_login")
.joins("left join lanes_users as created_by_user on " \
"created_by_user.id = #{t}.created_by_id")
end
if self.column_names.include?('updated_by_id')
q = q.select("updated_by_user.login as updated_by_login")
.joins("left join lanes_users as updated_by_user on " \
"updated_by_user.id = #{t}.updated_by_id")
end
q
end
|