Skip to content

Instantly share code, notes, and snippets.

@bryanl
Created June 2, 2009 18:20
Show Gist options
  • Select an option

  • Save bryanl/122451 to your computer and use it in GitHub Desktop.

Select an option

Save bryanl/122451 to your computer and use it in GitHub Desktop.
has_many_using :memberships, :using=>:group_ids, :group=>'@alias@.user_id', :readonly=>true,
:include=>:user, :conditions=>"users.completed = 1", :with_deleted=>true,
:select=>%q{
MIN(@alias@.id) id, @alias@.user_id, NULL group_id, NULL primary_email,
BIT_OR(@alias@.desired_personas) desired_personas,
MIN(@alias@.prof_photo_id) pp_photo_id, MIN(@alias@.pers_photo_id) ps_photo_id,
BIT_OR(@alias@.profile_flags) profile_flags,
MIN(@alias@.pers_name_privacy) pers_name_privacy, MIN(@alias@.prof_name_privacy) prof_name_privacy,
MIN(@alias@.pers_birthday_privacy) pers_birthday_privacy, MIN(@alias@.prof_birthday_privacy) prof_birthday_privacy,
MIN(@alias@.hide_relationship_status) hide_relationship_status, MIN(@alias@.hide_looking_for) hide_looking_for,
MIN(@alias@.hide_interested_in) hide_interested_in, MIN(@alias@.hide_bio) hide_bio,
MIN(@alias@.hide_pers_interests) hide_pers_interests, MIN(@alias@.hide_pers_photos) hide_pers_photos,
MIN(@alias@.hide_prof_photos) hide_prof_photos, MIN(@alias@.hide_organizations) hide_organizations,
MIN(@alias@.hide_contact) hide_contact, MIN(@alias@.hide_pers_education) hide_pers_education,
MIN(@alias@.hide_prof_education) hide_prof_education, AVG(@alias@.sect_contact0) sect_contact0, AVG(@alias@.sect_bio0) sect_bio0,
AVG(@alias@.sect_organizations0) sect_organizations0, AVG(@alias@.sect_feeds0) sect_feeds0,
AVG(@alias@.sect_endorsements0) sect_endorsements0, MIN(@alias@.sect_education0) sect_education0,
AVG(@alias@.sect_objectives0) sect_objectives0, AVG(@alias@.sect_connections0) sect_connections0,
AVG(@alias@.sect_photos0) sect_photos0, AVG(@alias@.sect_activity0) sect_activity0, AVG(@alias@.sect_groupinfo0) sect_groupinfo0,
AVG(@alias@.sect_contact1) sect_contact1, AVG(@alias@.sect_persinterests1) sect_persinterests1,
AVG(@alias@.sect_feeds1) sect_feeds1, AVG(@alias@.sect_endorsements1) sect_endorsements1, AVG(@alias@.sect_education1) sect_education1,
AVG(@alias@.sect_photos1) sect_photos1, AVG(@alias@.sect_activity1) sect_activity1, AVG(@alias@.sect_groupinfo1) sect_groupinfo1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment