# Newbie Formating output

**URL:** <https://www.ruby-forum.com/t/newbie-formating-output/98407>\
**Category:** Rails\
**Created:** [July 14, 2006, 3:05pm UTC](https://www.ruby-forum.com/t/newbie-formating-output/98407 "2006-07-14T15:05:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedx78](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/13edae/32.png) [@pedx78](https://www.ruby-forum.com/u/pedx78)\
**Post date:** [July 14, 2006, 3:05pm UTC](https://www.ruby-forum.com/t/newbie-formating-output/98407/1 "2006-07-14T15:05:32Z")

</div>

Hi, am a rails newbie. I had problems with 2 tasks  
i have created a guestbook app just to try out rails  
users sign guestbook by leaving name and message

currently, the list action shows plain text like this:  
Joe S.  
love your guestbook

but i would like to add formating to the name field, say different  
colour, bold, and add time eg:  
Joe S. (in red colour) wrote 5 days ago  
love your guestbook

The app also has an admin interface to edit and delete guest entries  
i want any entry which was edited by the admin to append a note to the  
message, saying “this entry was modified by admin”

how do i achieve the above 2 tasks?

database table guests has 2 columns, name and message

---

<div class="post-metadata">

**Author:** ![pedx78](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/13edae/32.png) [@pedx78](https://www.ruby-forum.com/u/pedx78)\
**Post date:** [July 14, 2006, 3:26pm UTC](https://www.ruby-forum.com/t/newbie-formating-output/98407/2 "2006-07-14T15:26:45Z")

</div>

Hi Pedro,

pedro alvarez wrote:

> i would like to add formating to the name field,  
> say different colour, bold,

This is a basic HTML question having nothing at all to do with Ruby or  
Rails. There’s an excellent reference site for this type of question at

> **[W3Schools Online Web Tutorials](https://www.w3schools.com/)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

and add time eg:

> Joe S. (in red colour) wrote 5 days ago

Check out the time\_ago\_in\_words method at [http://api.rubyonrails.org/](http://api.rubyonrails.org/)

To test out how the various methods work, you should get used to using  
irb  
(interactive ruby). You start it by entering ‘ruby script\console’ at  
the  
command prompt in an application directory in Windows. And remember,  
Google  
is your friend. 😉

> The app also has an admin interface to edit and  
> delete guest entries i want any entry which was  
> edited by the admin to append a note to the  
> message, saying “this entry was modified by admin”

Assuming you have a login / authentication system in place, you’d add a  
column to your table that allows you to record who does what to an  
entry.  
Recommend you pick up a book or two: “Agile Web D. with Rails”  
and  
“Programming Ruby” are the two most of us start with. Also recommend  
working through one or more of the tutorials available online before  
striking out on your own. The questions you’ve asked here are things  
you’ll  
learn in a couple of hours with most any of those.

hth,  
Bill

---

<div class="post-metadata">

**Author:** ![pedx78](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/13edae/32.png) [@pedx78](https://www.ruby-forum.com/u/pedx78)\
**Post date:** [July 14, 2006, 3:32pm UTC](https://www.ruby-forum.com/t/newbie-formating-output/98407/3 "2006-07-14T15:32:34Z")

</div>

pedro alvarez wrote:

> Hi, am a rails newbie. I had problems with 2 tasks  
> i have created a guestbook app just to try out rails  
> users sign guestbook by leaving name and message
> 
> currently, the list action shows plain text like this:  
> Joe S.  
> love your guestbook
> 
> but i would like to add formating to the name field, say different  
> colour, bold, and add time eg:  
> Joe S. (in red colour) wrote 5 days ago  
> love your guestbook
> 
> The app also has an admin interface to edit and delete guest entries  
> i want any entry which was edited by the admin to append a note to the  
> message, saying “this entry was modified by admin”
> 
> how do i achieve the above 2 tasks?
> 
> database table guests has 2 columns, name and message

I hope I understand you corretly but I think so.

What you want is best done with css. If you have a or a

, or  
what ever, you just add a class to it and define it in a stylesheet. If  
you’ve done a scaffold you have a scaffold.css in the  
/public/stylesheets folder. Or another css.

Add a class to the td in the view page like balalala

Then in the css add

.myredstyle {color: red; font-weight: bold}

As Bill said [CSS Tutorial](http://www.w3schools.com/css/default.asp) is good.

---

<div class="post-metadata">

**Author:** ![pedx78](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/13edae/32.png) [@pedx78](https://www.ruby-forum.com/u/pedx78)\
**Post date:** [July 25, 2006, 1:03am UTC](https://www.ruby-forum.com/t/newbie-formating-output/98407/4 "2006-07-25T01:03:31Z")

</div>

Tolle Seite! Hat mir sehr gefallen. Weiter so!

---

<div class="post-metadata">

**Author:** ![pedx78](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/13edae/32.png) [@pedx78](https://www.ruby-forum.com/u/pedx78)\
**Post date:** [July 25, 2006, 1:03am UTC](https://www.ruby-forum.com/t/newbie-formating-output/98407/5 "2006-07-25T01:03:32Z")

</div>

keep creating… Kris

---

<div class="post-metadata">

**Author:** ![pedx78](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/13edae/32.png) [@pedx78](https://www.ruby-forum.com/u/pedx78)\
**Post date:** [July 25, 2006, 1:03am UTC](https://www.ruby-forum.com/t/newbie-formating-output/98407/6 "2006-07-25T01:03:43Z")

</div>

Unbelievable! Liam O’ Keefe
