I have a controller, SubOrder, that my clients use to place orders with our company. I pass in a userid, which I would like to use to find a specific user within the controller. Seems easy, right? Here's the relevant code (within the create action of the SubOrder controller): sub_order = SubOrder.new(sub_order_params) user = User.find(sub_order[:userid]) ... private def sub_order_params params.require(:sub_order).permit(:userid... end When I am running my Rspec tests to test the create action, I'm getting the following error message: ActiveRecord::RecordNotFound:Couldn't find User with 'userid'= When I run this exact code in the console, sub_order contains all the params I passed, and user has the correct userid stored, so I'm not sure what is going on. The only possibility I can think is that the userid is a uuid, and I'm trying to find it by string, or something like that?
on 2016-11-18 03:02