Rails 4 Strong Parameters nested attributes with a key associated with an Object. #9051

Closed
burmjohn opened this Issue Jan 23, 2013 · 4 comments

Projects

None yet

3 participants

I was playing around with Rails 4 beta and trying to get nested attributes working with carrierwave, however I ran across an issue. Unless I am doing something wrong I believe this may be a bug. I could not find any references anywhere dealing with this. Thank's in advance.

upload = ActionDispatch::Http::UplaodedFile.new tempfile: StringIO.new("abc"), filename: "abc"
params = ActionController::Parameters.new screenshot: { title: "afa", assets_attributes: {"0" => {filename: upload}}}
p = params.require(:screenshot).permit(:title, assets_attributes: :filename)

# => {"title" => "afa", "assets_attributes"=>{"0"=>{}}}

This seems to be related to rails/strong_parameters#89 /cc @fxn

Owner
fxn commented Jan 23, 2013

Could you please log params.inspect?

Owner
fxn commented Jan 23, 2013

Ah, sorry, didn't realize the snippet is isolated. I believe we need to add ActionDispatch::Http::UploadedFile to the list of permitted scalars, we only allow IO and StringIO right now.

If there is anything else you need let me know.

@fxn fxn closed this in 8ac94d7 Jan 23, 2013
@nicolasiensen nicolasiensen pushed a commit to nicolasiensen/helpful-web that referenced this issue May 25, 2014
Nícolas Iensen Update Rails to 4.1.1 since 4.1.0 had a bug with attachments upload #… 7f08bc9
@nicolasiensen nicolasiensen referenced this issue in asm-helpful/helpful-web May 25, 2014
Merged

Add attachments support for messages #467 #221

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment