Re: Display a string properly in View

Andrew Timberlake
Thu, 18 Jun 2009 09:20:00 -0000

On Thu, Jun 18, 2009 at 11:12 AM, Valentino Lun <
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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.)..
> <%= @event.event_detail.event_detail.gsub("\n",
" ") %>
> 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.
> <%= puts @event.event_detail %>
>
> Many thanks
> Valentino
>

Remove the puts and just use <%= @event.event_detail... %>
The ''<%='' is like puts

Andrew Timberlake
http://ramblingsonrails.com

http://MyMvelope.com - The SIMPLE way to manage your savings

--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---