Skip to content

Instantly share code, notes, and snippets.

@bfabry
Created March 15, 2012 22:52
Show Gist options
  • Save bfabry/2047468 to your computer and use it in GitHub Desktop.
Save bfabry/2047468 to your computer and use it in GitHub Desktop.
108: conditions[dsa.column_name.to_sym] = [value]
109: end
110:
111: record_count = staging_table_active_record.count(:conditions => conditions)
112:
=> 113: binding.pry
114: record_count > 0
115: end
116:
117: def staging_table_active_record
118: @staging_table_active_record ||= @upload_attempt.dataset.active_record_class
[1] pry> conditions
=> {:id=>[nil], :murder_date=>["1986-10-31"]}
[2] pry> staging_table_active_record.count(:conditions => conditions)
=> 0
[3] pry> staging_table_active_record.find_all_by_murder_date('1986-10-31')
=> [#<OfficeMurderPool2002 audit_id: 0, id: 1, murder_date: "1986-10-31", murderer: "Alice", murderee: "Bob">,
#<OfficeMurderPool2002 audit_id: 0, id: nil, murder_date: "1986-10-31", murderer: "Alice", murderee: "Fred">]
[4] pry>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment