I'm working on Rails 3.2.9 app with ruby 1.9.3 and mysql as my DB . I want to retrieve a particular column data called 'no_of_tc'from a model named "excel_file' but i dont have the primary key/id of tat row . All i have is the filename.
tc_no = ExcelFile.find(35).no_of_tc gives me the result but i dont have id all the time
tc_no = ExcelFile.find_by filename: 'excel_name' gives the error "unknown method - find_by"
How can i get the required data without having the primary key?? and why am I getting unknown method error for 'find_by'