mercredi 29 juin 2016

Move all nil dependent value using ActiveRecord

I have two model Student and Information. Is this a order by nil?

Student | Information
Leo     | nil
Paul    | Some info1
Peter   | Some info2
Rex     | nil

How can I order it using active record and will show this result:

Student | Information
Paul    | Some info1
Peter   | Some info2
Rex     | nil
Leo     | nil

All nil Student.information.nil? will move down using ActiveRecord.

Aucun commentaire:

Enregistrer un commentaire