See the output of the application at http://www.samwoodard.com/mirador.pdf. I have partial month, which
should actually be called “months”, but this is semantic:
<%for i in 0..6 %>
<%end%>
<% days_in_first_week = 0
for i in 0..6
%>
<%day=@current_two_months[0][days_in_first_week]%>
<% days_in_first_week += 1 if
@current_two_months[0][days_in_first_week].date.wday == i
end%>
<%for day in @current_two_months[0][days_in_first_week,
@current_two_months[0].length - days_in_first_week]%>
<%if day.date.wday == 0%><%end%>
<%end%>
<%end%>
<%for i in 0..6 %>
<%end%>
<% days_in_first_week = 0
for i in 0..6
%>
<%day=@current_two_months[1][days_in_first_week]%>
<% days_in_first_week += 1 if
@current_two_months[1][days_in_first_week].date.wday == i
end%>
<%for day in @current_two_months[1][days_in_first_week,
@current_two_months[1].length - days_in_first_week]%>
<%if day.date.wday == 0%><%end%>
<%if day.date.wday == 6%><%end%>
<%end%>
<%= Date::DAYNAMES[i][0,1] %>
<%= link_to_remote
@current_two_months[1][days_in_first_week].date.mday, :url => {:action
=> 'end_date', :id => day} if
@current_two_months[1][days_in_first_week].date.wday == i %>
Why is this rendering doing what it is doing in the attached output?
I’ve tried debugging the javascript, but I cannot find out what this “e”
is that javascript is trying to output using e.toString() (see output).
The partial works fine before the javascript render.
It looks like you’ve set :update on whatever variant of link_to_remote
you’re using - this expects the ajax call to return a chunk of html,
whereas you’re using an rjs, which returns a chunk of javascript to be
evaluated.
Since it’s expecting html, the ajax thingy just includes the rjs output
verbatim in the page.
The e in question is the exception thrown should execution of the
javascript fail.
It looks like you’ve set :update on whatever variant of link_to_remote
you’re using - this expects the ajax call to return a chunk of html,
whereas you’re using an rjs, which returns a chunk of javascript to be
evaluated.
Since it’s expecting html, the ajax thingy just includes the rjs output
verbatim in the page.
The e in question is the exception thrown should execution of the
javascript fail.
Either don’t use a :update in your link to remote or just render the
partial instead of rendering the rjs.
Fred
Is there a way to tell :update to render a partial in place of the DOM
element stored there instead of a template named after the action called
by the link_to_remote?
:update doesn’t do that - it just generates the right js so that the
correct DOM element is replaced with the result of the action.
However, on your action you can call render with whatever parameters you
feel like (for example render :partial => ‘month’, :object => foo)
Fred
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.