modified device_details method and scope sort_by_id