14 Jun 2013, 00:01
Samr_small_pragsmall

Sam Ruby (567 posts)

(from Agile Web Development with Rails 4 > Uploading Files to Rails Applications)

Thanks! Will fix in next beta.

13 Jun 2013, 21:43
Generic-user-small

Mike Ruch (2 posts)

(from Agile Web Development with Rails 4 > Uploading Files to Rails Applications)

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

@picture = Picture.new(picture_params)

Then, I added the following to the controller:

private

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

Everything worked fine after that.

13 Jun 2013, 20:43
Generic-user-small

Richard Wilson (6 posts)

(from Agile Web Development with Rails 3.2 > I cant progress with Rails 3.2 anymore because of all of these attr_accessible issues)

➜ ~ rails -v
Rails 3.2.13

(rails version)

13 Jun 2013, 20:43
Generic-user-small

Richard Wilson (6 posts)

(from Agile Web Development with Rails 3.2 > I cant progress with Rails 3.2 anymore because of all of these attr_accessible issues)

In the triangle it says Rails 3.2

Book version: P2.2—January 2012

vi is the contents…

13 Jun 2013, 20:28
Generic-user-small

Brian Palmer (1 post)

(from Programming Elixir > escriptize error)

I was stumped on this too until I found this thread. Can anybody explain why this is necessary? It seems like the binary generated by `mix escriptize` is ignoring the application section of mix.exs, where :httpotion is normally started.

13 Jun 2013, 20:04
Generic-user-small

Mike Ruch (2 posts)

(from Agile Web Development with Rails 4 > Uploading Files to Rails Applications)

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.new(params[: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.

thx

13 Jun 2013, 12:42
Generic-user-small

Steve Holland (9 posts)

(from Agile Web Development with Rails 4 > Images not found in app/assets/images (page 69 - Iteration A2))

@ignacio – Excellent! Glad I could help.

@Sam – That would be great, thanks for taking the time to look at this for us. It’s much appreciated.

13 Jun 2013, 12:14
Samr_small_pragsmall

Sam Ruby (567 posts)

(from Agile Web Development with Rails 4 > Images not found in app/assets/images (page 69 - Iteration A2))

If I can build a test case, I either will fix it or get it to be fixed in the Rails final release. Based on the link above, this might already be fixed in 4.0.0.rc2.

13 Jun 2013, 11:39
Generic-user-small

Ignacio R (2 posts)

(from Agile Web Development with Rails 4 > Images not found in app/assets/images (page 69 - Iteration A2))

Steve,

Your solution works like a charm! Thanks a lot!

Sam,

Maybe it would be a good idea to mention in the book to turn off the server when adding external files and then restart it once they have been transferred?

13 Jun 2013, 11:02
Generic-user-small

Steve Holland (9 posts)

(from Agile Web Development with Rails 4 > Images not found in app/assets/images (page 69 - Iteration A2))

Hi all,

I just though I’d give an update on this because I’ve just tried moving the /images back into /assets and it all seems to be working now without a hitch!

What I think might be the cause is this…

If you already had the server running (which I did), when you manually created the /images folder in /assets, the change isn’t picked up at all. I’ve since come back to it and restarted the server several times as I’ve moved through he book and the /images folder is now recognised.

So for me at least I think the root of the issue is just that the images folder isn’t automagically created when you create your app with the generator.

Hope this help everyone.

Thanks
Steve