So I've got a method that I'm using to sort by the result instead of a database column at the moment which works nicely. It will return from the below each loop with a value against each record, then sort the table based on these:

```
<% @records.sort_by(&:methodName).reverse.each do |record| %>
    <%= record.methodName %>
<% end %>

```

This works really well - however this method only gets used after a user interacts with the record itself. For instance like a rating, so a record will begin life without a rating, then ratings will be submitted after this point.

It works nicely, until you create a new record that doesn't have a value for this to sort by - is there a way of saying "Sort by what this method returns, if the record doesn't have a value for this, put it at the bottom"?

At the moment I get an exception because it's not a number 'NaN'...because it's empty :(

As always - any help massively appreciated for a Rails beginner here..!