if params[:status] && params[:carrier]
  conditions = ["actual_delivery IS NOT NULL AND actual_delivery > scheduled_delivery AND status_id = ? AND carrier_id = ?", status.id, carrier.id]
elsif params[:status]
...

Ruby Multiple params in find query

by Shpigford, October 29, 2010 19:03, 2 refactorings, tagged with rails, find

Need some help refactoring ...

9d4eaaf6c763c9fc01a9356ef58dbe72 Talk
if !birthdate.blank? && !location.blank? && !joined.blank? && !death.blank?
  "<p class='birthinfo'>#{name} was born on #{birthdate.strftime("%A, %B %e, %Y")} in #{location}. #{sex} passed away on #{death.strftime("%B %e, %Y")} at the age of #{calculate_age(birthdate, death)}. #{sex} was a member of #{link_to user.login, profile_path(user.permalink)}'s family for #{distance_of_time_in_words(joined,death)}.</p>"
elsif !birthdate.blank? && !location.blank? && !joined.blank? && death.blank?
...

Ruby Massive if/elsif statement ...

by Shpigford, July 30, 2009 04:26, 9 refactorings, tagged with ruby

The following if/elsif stat...

9d4eaaf6c763c9fc01a9356ef58dbe72 Talk
<?php
function makeSafe($variable, $escape=true) {
	$variable = htmlentities($variable, ENT_QUOTES);
...

PHP makeSafe Content Filter

by Shpigford, October 02, 2007 11:15, 8 refactorings

This is the function I've b...

9d4eaaf6c763c9fc01a9356ef58dbe72 Talk