Hi Valentino
You shouldn't use puts, for output in the view.
You probably want to split the info for each event into seperate cells
so your table is well-structured.
In which case I'd write a helper_method and throw most of the work
into there.
If not, you can stop html from collapsing white-space by either
replacing each space with (non-breaking space) or set the
table's style:
table {
white-space: pre;
}
in your css.
Gav
http://handyrailstips.com
On Jun 18, 10:12 am, Valentino Lun <[email protected]>
wrote:
> Dear all
>
> I have problem in print the string in View.
>
> @event = Event.first
>
> puts @event.event_detail
> dreq_reqno dreq_status dreq_create_time
> 09P0917228 0 18 Jun 2009 16:32
> 09P5075748 0 18 Jun 2009 16:32
> 09P5075755 0 18 Jun 2009 16:33
> The format is pretty good using puts
>
> But when I print this in View, the format disorder (Some spaces are
> trimmed.)..
> <td><%= @event.event_detail.event_detail.gsub("\n", "<br>") %></td>
> dreq_reqno dreq_status dreq_create_time
> 09P0917228 0 18 Jun 2009 16:32
> 09P5075748 0 18 Jun 2009 16:32
> 09P5075755 0 18 Jun 2009 16:33
>
> How can I have the "puts @event.event_detail" in View?? I tried this,
> but not work.
> <td><%= puts @event.event_detail %></td>
>
> Many thanks
> Valentino
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---