I’m a RoR beginner and I can’t seem to find a tutorial on the following thing:
I want to add a picture for each of the tv shows in my database and then want to display the image by calling @show.image in my view (show being a tv show).
First, what’s the column content ? (I would assume a string, but I’m thinking there might be something more appropriate)
Second, is there a way that I won’t need to add URL’s manually to the DB ? Like if I could somehow specify that the image name is the same as the tv show’s name ?
My questions might be a bit confusing so please let me know if you cant understand what I mean!
Cheers
You need to use a gem called paperclip, it is very good.
Here is a link to the railscast
The railscast is pretty old, so the paperclip is a plugin, which won’t work with rails 3.2 + .
The below github link will be of better use
Also the gem is open source and you can see this on github