Skip to content

Instantly share code, notes, and snippets.

@jamonholmgren
Last active August 29, 2015 13:58
Show Gist options
  • Save jamonholmgren/10170472 to your computer and use it in GitHub Desktop.
Save jamonholmgren/10170472 to your computer and use it in GitHub Desktop.
Chaining styles.
school.schools_users
.joins("LEFT JOIN users ON users.id = schools_users.user_id")
.where(self.filters)
.where(self.search_string)
.order(order)
school
.schools_users
.joins("LEFT JOIN users ON users.id = schools_users.user_id")
.where(self.filters)
.where(self.search_string)
.order(order)
school.schools_users.joins("LEFT JOIN users ON users.id = schools_users.user_id")
.where(self.filters)
.where(self.search_string)
.order(order)
school.schools_users.joins("LEFT JOIN users ON users.id = schools_users.user_id").where(self.filters).where(self.search_string).order(order)
q = school.schools_users
q = q.joins("LEFT JOIN users ON users.id = schools_users.user_id")
q = q.where(self.filters)
q = q.where(self.search_string)
q = q.order(order)
@beathyate
Copy link

I like the 3rd option.

@amirrajan
Copy link

First option

@darrencauthon
Copy link

3rd option.

@nata79
Copy link

nata79 commented Apr 8, 2014

1st

@Andorbal
Copy link

Andorbal commented Apr 8, 2014

First option

@willrax
Copy link

willrax commented Apr 8, 2014

1st

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment