rails3 - which is better code for performance
问题 Which is the best practise and gives me better performance ? For example: I have statuses table which have 5 records and each record need to be store on separate variable. Method1: @new_status = Status.find_by_status("NEW") @inprocess_status = Status.find_by_status("InProcess") @completed_status = Status.find_by_status("Completed") @occupied_status = Status.find_by_status("Occupied") @success_status = Status.find_by_status("Success") Method2: statuses = Status.all @new_status = statuses.find