So shall i write the sample_resource.rb to encode the resource? 
Actually, it's the same bits of code for the study and the user in an order (except that the code is in the order_resource.rb)