Accessing a nested hash in a controller
- by Magicked
I have the following (snipped) parameters passed into my controller.
Parameters: {"commit"=>"OK", "action"=>"set_incident_incident_status_id", "id"=>"1", "controller"=>"incidents", "incident"=>{"incident_status_id"=>"1"}}
I know that if I want to select the incident, I can do:
@incident = Incident.find(params[:id])
How do I access the "incident"={"incident_status_id"="1"}?
I thought to try something like:
@incident_status = IncidentStatus.find(params[:incident => :incident_status_id])
But that didn't work. I'm assuming it's just a syntax problem at this point, and I haven't found a solution yet. Any help would be much appreciated!