I am new to rails ,
I have added a new column “control_id” in a table users and same is added in model file under
attr_accessible :control_id
But when I use find_by_control_id(1) . I am getting undefined method error . Do I need to add the column any where else ?
code :
search_id = User.find_by_control_id(1).id
in the webhook i will get control_id , i need to use the control_id to find the id in users table
Thanks
attr_accessiblehas nothing to do with finders or declaring attributes - its an old and depreciated way of doing mass assignment protection. ActiveRecord generates dynamic finders based on the database schema.