small medium large xlarge

13 Jun 2013, 20:04
Mike Ruch (2 posts)

In section 21.4, Uploading Files to Rails Applications, the following line appears in the definition of the save action for the upload controller:

@picture =[:picture])

Predictably, that threw an exception. I think it needs to be updated for strong parameters. I installed the protected attributes gem to get around it, but I’d be interested in seeing how you would set the strong parameters for a file upload.


13 Jun 2013, 21:43
Mike Ruch (2 posts)

This actually wasn’t difficult. I changed the line to:

@picture =

Then, I added the following to the controller:


def picture_params params.require(:picture).permit(:comment, :uploaded_picture) end

Everything worked fine after that.

14 Jun 2013, 00:01
Sam Ruby (634 posts)

Thanks! Will fix in next beta.

You must be logged in to comment