I can work around this if it isn't possible, but I am looking to
create a scope for a model which returns records based on the result
of a model function.
Essentially, I have the following:
The contract_statuses are there to track the status of a contract over
time with the latest being the current status for a particular
contract. A 'status' simply has a 'name' field.
In my contract model, i have a current_status function which returns
the contract_status record that was relevant as a particular time,
given a date parameter.
The scope I would like would be something like contracts.active, where
active relates to the name of the current status. Ideally, I would
like to get the status through the current_status method of the
contract, but I've not been able to find a way to do this in a
Is this possible?