Skip to content

Instantly share code, notes, and snippets.

View geoffreyd's full-sized avatar

Geoffrey Donaldson geoffreyd

View GitHub Profile
def self.first_uninteresting
last = 0
Number.all(:order => "number").each do |n| # Number.find/all will return an enumerable, so you can each it directly.
return last + 1 if n.number.to_i != last + 1 # if's can be on the same line at the end for basic tests
last = n.number.to_i #ops forgot the number casting
end
last + 1 # Ruby will automatically return the last valuation, no need for 'return'
end
// ..........................................
// REFRESH
refreshRecords: function(records, options) {
if (!records || records.length == 0) return ;
if (!options) options = {} ;
records = records.byResourceURL() ; // group by resource.
for(var resource in records) {
if (resource == '*') continue ;
/**
@property
This is the actual array of records in the current collection. This
property will change anytime the record members change (but not when
the member record properties change).
@type {Array}
*/
records: function() {