Automatic .santize?

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 =
Event.find_by_date("#{@temp13.year}-#{@temp13.month}-#{@temp13.day}")
if @event == nil
@@td = “

#{@temp13.to_s[0,3]} |
#{@temp13.day}

@@ntd = “#{@temp13.to_s[0,3]}
| #{@temp13.day}

else
@@td = “#{@temp13.to_s[0,3]} | #{@temp13.day}
<%=
link_to @event.title, :action => :show_date, :id => @event.id
%>

@@ntd = “#{@temp13.to_s[0,3]}
| #{@temp13.day}
<%= link_to @event.title, :action => :show_date, :id
=> @event.id %>

end
now when I run it on the days with events it shows <%= link_to
@event.title, :action => :show_date, :id => @event.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?

On May 31, 2006, at 1:06 PM, Programmer wrote:

#{@temp13.day}"
| #{@temp13.day}
<%= link_to @event.title, :action
Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

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:

http://www.jvoorhis.com/pages/calendar-helper

Cheers-
-Ezra