Ruby on Rails - generating column for text field and photos

I am new to rails, so I apologize for the simple questions. I create a website for the company. This company wants to display it on the site. I would like to let the client manage this myself.

I create a table for "customers", and the three columns that I would like to have are: company name, company description and logo. I use the name: string for the name, but I donโ€™t know how best to create a column for the description (since I intend to have it as a text area) and images in the terminal script / generate scaffold command. My suspicion is that the description (which I would like to be a text field) should still be a description: string, and then just adjust in real form. Not sure what to do for the image field.

So ... a long way to say: what should I enter to create the description and image columns in the scaffold command?

+4
source share
1 answer

For the database column "text" (longer than the row / varchar):

description:text 

There are many ways to process images. If you want to save only the image URL, use the column picture:string or picture:text . If you want users to upload their photo, it was a lot more complicated, and I recommend taking a look at the Paperclip plugin.

+8
source

All Articles