Sometimes it may happen you want to sort the array of objects, fetched from ActiveRecord.
e.g. I have a users table having name column after I done any manipulation on the fetched object.
You can just call the following code for doing the above stuff.
@users = User.find :all
@users = @users – xyz_obj.users #remove existing users.
@users = @users.sort_by { |user| user[:name] }
May this code helps anyone….
Thanks

