I am self-learning ruby by watching few videos and reading through blogs. I am currently in a situation where I have to parse the below parameters that I receive from an external CRM system into RUBY and find the relevant records from the database and delete them. It works well when I get a single record through below code:
temp_id = params[:salesforce_id]
Table.find_or_initialize_by(:id => temp_id).destroy
but I am struggling when I have to parse through multiple records like below, I get this error "ArgumentError (wrong number of arguments (given 0, expected 1)):" I might have to loop through this but any sample code will really help.
{"_json"=>[{"id"=>"1"}, {"id"=>"2"}, {"id"=>"3"}], "delete_record"=>{"_json"=>[{"id"=>"1"}, {"id"=>"2"}, {"id"=>"3"}]}}
Thanks