varchar size for a blog post


I know this ones a dumb question. I wanna create a blog and store the
article in DB. it can be HUGE text.

Can someone please mention the data type in rails and its equivalent
in my sql is generally used?

You want a text column


yes... text area to write the article and then save the whole article
in DB
not sure which datatype to use
1. varchar 2000 / 4000 ...
2. clob blob

yes... text area to write the article and then save the whole article
in DB

You didn't quite understand me. The column type you want (at least in
mysql, sqlite3, postgresql etc) is called text


woops :D... ok let me check. Thanks a lot boss!

Frederick Cheung wrote:

text works! :slight_smile: yupiieee... thanks a lot!

talking about text fields…

I have a text area of 30 columns in my html viewer of a text field

It works fine, for all CRUD operations. The only detail is about te
text don,t include any controls ("\n" or “\l\n”) for the lines was
auto-breaked into the text area of the form.

I want to count the number of lines of this text area, but my code
fails because I am counting “\n” marks.

I know this looks like an “HTML” issue (not Rails) but all suggestions
will be appreciated.

Thanks in advance


Robert Walker escribió:

You could count the number of lines like this:

lines = filed_name.split("\n").size

If I'm understanding what you are asking about.


Thanks, but This is the way I already use.

It doesn-t works for the lines you type over the size (in columns) of
the text area. In this case, the text wrap on the next line but no
mark “\n” came with it.

In this cases we will get the count of 1 line and inside the text area
we will visualize 2 lines.


Carl escribió: