On Tuesday, May 24, 2011 1:33:26 PM UTC-6, Philip wrote:
>
>
> On May 24, 2011, at 12:16 PM, Jedrin wrote:
>
> >
> > So I have some old code that used to work and I am trying to
> > resurrect it.
> >
> > The controller has this:
> >
> > @content=""
> > for i in 0..w.size
> > @content = @content + "<span id=\"w#{i}\" style='display:none'>
> > #{w[i]} </span>"
> > end
> > @content = "<div style=\"font-size:100;color:blue;\">" + @content +
> > "</div>"
> >
> > @txt_divs = ""
> > for i in 0..5
> > span = ""
> > for j in 0..10
> > span = "#{span} <span id='sp#{i}_#{j}' style='display:none'> </
> > span>"
> > end
> > div = "<div> #{span} </div>"
> > @txt_divs << div << "\n"
> > end
> >
> >
> >
> >
> > In the view I then do this:
> >
> >
> > <%= @content%>
> >
> > <%= @txt_divs %>
>
> <%= raw @content %>
>
> Seems like you should move that into the view if you can though...
>
> -philip
>
Additionally, as you take Philip's suggestion, you ought to consider the
power of using partials:
http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials
Specifically, check out section 3.4.5, "Rendering Collections"
--
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.