Forum: Ruby on Rails Automatic .santize?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Programmer (Guest)
on 2006-05-31 22:06
Hello and thanks in advance to those who post back,

I'm working on a calender but, it renders the data in the controller
then saves it as @code so I call it in the veiw <%= @code %>. So
everythings working and I add this line..
@event =
if @event == nil
 @@td = "<td width=50 height=50
valign=top><small><b>#{@temp13.to_s[0,3]} |
 @@ntd = "<td width=50 height=50 valign=top><small>#{@temp13.to_s[0,3]}
| #{}</small></td>"
 @@td = "<td width=50 height=50
valign=top><small><b>#{@temp13.to_s[0,3]} | #{}</b><br><%=
link_to @event.title, :action => :show_date, :id =>
 @@ntd = "<td width=50 height=50 valign=top><small>#{@temp13.to_s[0,3]}
| #{}<br><%= link_to @event.title, :action => :show_date, :id
=> %></small></td>"
now when I run it on the days with events it shows <%= link_to
@event.title, :action => :show_date, :id => %> why dosn't it
run the code? Is there a way around this or do I need to move my code in
to my templete?
Ezra Zygmuntowicz (Guest)
on 2006-05-31 23:48
(Received via mailing list)
On May 31, 2006, at 1:06 PM, Programmer wrote:

> #{}</b></small></td>"
> | #{}<br><%= link_to @event.title, :action
> Posted via
> _______________________________________________
> Rails mailing list

You need to move that code into the view file where it belongs. Doing
it in your controller like that will not evaluiate the erb template
statements so you get the results you are currently seeing. Also I am
wondering why you are using class variables here @@ ? THey will cause
you problems so you shouldn't use them unless you have a very good
reason to do so.

	You could also use much better and more descriptive variable names.
temp1 temp2 are horrible names for vars. ALso there is a calendar
helper already available that might save you a ton of work here:

This topic is locked and can not be replied to.