Ruby on Rails - generating column for textarea and pics
I am new to rails so excuse the simple questions. I am creating a website for a company. That company wants to display it's clients on the site. I would like to allow the client to manage this themselves.
I am generating a table for the 'clients' and the three columns I would like to have are: Company Name, Company Description and logo. For the name I am using name:string but not sure how to best create the column for description (as I intend having it be a textarea) and pictures at the script/generate scaffold terminal command. My suspicion is that the description (which I would like to be a textarea) should still be description:string and then just adjust in the actual form. Not sure what to do for the picture field.
So...long way to say: what do I enter to generate the description and picture columns in the scaffold开发者_如何学Python command?
For a 'text' database column (longer than string/varchar):
description:text
There are many ways to handle pictures. If you want to store just the URL of an image, use a picture:string
column or picture:text
. If you want users to upload their own photo it's much more complicated and I'd recommend taking a look at the Paperclip plugin.
精彩评论