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: <div id="months"> <table><tr><td><div id="month_1"><h2><%=Date::MONTHNAMES[@current_two_months[0][0].date.month] %></h2> <table> <tr> <%for i in 0..6 %> <td><%= Date::DAYNAMES[i][0,1] %></td> <%end%> </tr> <tr> <% days_in_first_week = 0 for i in 0..6 %> <%day=@current_two_months[0][days_in_first_week]%> <td><%=if day.date.wday == i && ( !session[:prebooking] || !session[:prebooking].end_date) link_to_remote day.date.mday, :url => {:action => ''start_date'', :id => day}, :update => "months" elsif day.date.wday == i link_to day.date.mday, {:action => ''check_rate'', :id => day} else end%></td> <% days_in_first_week += 1 if @current_two_months[0][days_in_first_week].date.wday == i end%> </tr> <%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%><tr><%end%> <td><%=if !session[:prebooking] || !session[:prebooking].end_date link_to_remote day.date.mday, :url => {:action => ''start_date'', :id => day}, :update => "months" else link_to day.date.mday, {:action => ''check_rate'', :id => day} end%> <%if day.date.wday == 6%></tr><%end%> <%end%> </table></div></td> <td> <div id="month_2"><h2><%=Date::MONTHNAMES[@current_two_months[1][0].date.month] %></h2> <table> <tr> <%for i in 0..6 %> <td><%= Date::DAYNAMES[i][0,1] %></td> <%end%> </tr> <tr> <% days_in_first_week = 0 for i in 0..6 %> <%day=@current_two_months[1][days_in_first_week]%> <td><%= 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 %></td> <% days_in_first_week += 1 if @current_two_months[1][days_in_first_week].date.wday == i end%> </tr> <%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%><tr><%end%> <td><%= link_to_remote day.date.mday, :url => {:action => ''end_date'', :id => day}%></td> <%if day.date.wday == 6%></tr><%end%> <%end%> </table></div> </td></tr></table></div> which is rendered using an AJAX call to the action start_date or end_date. The rjs templates for start_date and end_date are the same: #start_date.rjs or end_date.rjs page.replace_html("months" , :partial => "month" , :object => @current_two_months) 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. What is going on here? Thank you, Sam -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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. Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> 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. > > FredSo what do I do to fix it? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Either don''t use a :update in your link to remote or just render the partial instead of rendering the rjs. Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> Either don''t use a :update in your link to remote or just render the > partial instead of rendering the rjs. > > FredIs 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? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
: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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---