I have an app structure with nested routes in which a
proposal belongs to a
request and a
request has many
When I execute a
send_proposal method, I am trying to get it to update the
status of the
request to which that
proposal belongs, but I am getting an error that says
undefined method 'request' for true:TrueClass.
My route for this method (not that I think it matters) is:
put "proposal/:id/send_proposal" => "proposals#send_proposal", as: "send_proposal"
Here is my
send_proposal method, as found in my
@proposal = Proposal.find(params[:id])
@proposal = @proposal.update_attributes(status: "Sent to Client")
@proposal.request = @proposal.request.update_attributes(archived: "Proposal Sent to Client") <<<<<<<<<ERROR CALLED ON THIS LINE
flash[:notice] = "Your proposal has been sent to the client!"
I have looked at many SO posts for other
TrueClass errors, but can't seem to find one with a problem like this. Can anyone see what I'm doing wrong or help me conceptualize what
TrueClass errors are generally about?