I have an full ajax app doing crud operations for contact info for one section. I was using ajax calls to edit and cancel and also to add a contact. I am implementing a button_to_function instead of doing an ajax call to just edit/add/or cancel a contact. I am running into a memory issue using the button_to_function or link_to_function. I have this: <%= link_to_function ''Edit Contact'' do |page| page[:showcontact].replace_html :partial => ''/contacts/ ajaxshoweditcontact'' end %> and the edit page also has this for the cancel: _ajaxshoweditcontact.rhtml. <%= button_to_function ''Cancel'' do |page| page[:showcontact].replace_html :partial => ''/contacts/ ajaxshowcontact'' end %> When I am trying to display the contact this: _ajaxshowcontact.rhtml. <%# = link_to_function ''Edit Contact'' do |page| page[:showcontact].replace_html :partial => ''/contacts/ ajaxshoweditcontact'' end %> is one of 2 options. Rails is saying that it cannot allocate memory for this and it will not even display the initial page that has the ''edit'' link. Is it trying to render all of the partials before the button or link is even clicked? I am trying to cut down on the ajax calls that are not neccesary. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
ok maybe not enough detail. When a user selects a person from a drop down selection it shows the user below with 2 options, to edit the user or delete the user <%= link_to_function ''Edit Contact'' do |page| page[:showcontact].replace_html :partial => ''/contacts/ ajaxshoweditcontact'' end %> Inside the ajaxshoweditcontact there is this link top cancel the edit: <%= button_to_function ''Cancel'' do |page| page[:showcontact].replace_html :partial => ''/contacts/ ajaxshowcontact'' end %> Is it generating the partials for both links when I go to the show page above? On Dec 6, 5:46 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have an full ajax app doing crud operations for contact info for one > section. I was using ajax calls to edit and cancel and also to add a > contact. I am implementing a button_to_function instead of doing an > ajax call to just edit/add/or cancel a contact. I am running into a > memory issue using the button_to_function or link_to_function. > > I have this: > > <%= link_to_function ''Edit Contact'' do |page| > page[:showcontact].replace_html :partial => ''/contacts/ > ajaxshoweditcontact'' > end %> > > and the edit page also has this for the cancel: > > _ajaxshoweditcontact.rhtml. > <%= button_to_function ''Cancel'' do |page| > page[:showcontact].replace_html :partial => ''/contacts/ > ajaxshowcontact'' > end %> > > When I am trying to display the contact this: > _ajaxshowcontact.rhtml. > <%# = link_to_function ''Edit Contact'' do |page| > page[:showcontact].replace_html :partial => ''/contacts/ > ajaxshoweditcontact'' > end %> > > is one of 2 options. > Rails is saying that it cannot allocate memory for this and it will > not even display the initial page that has the ''edit'' link. Is it > trying to render all of the partials before the button or link is even > clicked? > > I am trying to cut down on the ajax calls that are not neccesary.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2009-Dec-07 17:13 UTC
Re: link_to_function or button_to_function memory usage
On Dec 7, 4:28 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> ok maybe not enough detail. > > When a user selects a person from a drop down selection it shows the > user below with 2 options, to edit the user or delete the user > > <%= link_to_function ''Edit Contact'' do |page| > page[:showcontact].replace_html :partial => ''/contacts/ > ajaxshoweditcontact'' > end %> > > Inside the ajaxshoweditcontact there is this link top cancel the edit: > > <%= button_to_function ''Cancel'' do |page| > page[:showcontact].replace_html :partial => ''/contacts/ > ajaxshowcontact'' > end %> > > Is it generating the partials for both links when I go to the show > page above? >yes - it is generating the partials and including them in the page - if you look at the source of the page you''d see something like Element.update(''showcontact'', ''long html string here'') Fred> On Dec 6, 5:46 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I have an full ajax app doing crud operations for contact info for one > > section. I was using ajax calls to edit and cancel and also to add a > > contact. I am implementing a button_to_function instead of doing an > > ajax call to just edit/add/or cancel a contact. I am running into a > > memory issue using the button_to_function or link_to_function. > > > I have this: > > > <%= link_to_function ''Edit Contact'' do |page| > > page[:showcontact].replace_html :partial => ''/contacts/ > > ajaxshoweditcontact'' > > end %> > > > and the edit page also has this for the cancel: > > > _ajaxshoweditcontact.rhtml. > > <%= button_to_function ''Cancel'' do |page| > > page[:showcontact].replace_html :partial => ''/contacts/ > > ajaxshowcontact'' > > end %> > > > When I am trying to display the contact this: > > _ajaxshowcontact.rhtml. > > <%# = link_to_function ''Edit Contact'' do |page| > > page[:showcontact].replace_html :partial => ''/contacts/ > > ajaxshoweditcontact'' > > end %> > > > is one of 2 options. > > Rails is saying that it cannot allocate memory for this and it will > > not even display the initial page that has the ''edit'' link. Is it > > trying to render all of the partials before the button or link is even > > clicked? > > > I am trying to cut down on the ajax calls that are not neccesary.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Chris Habgood
2009-Dec-07 17:16 UTC
Re: Re: link_to_function or button_to_function memory usage
It is all ajax and it never complete out. It looks like it is in a loop generating each partial over and over again. when it finally times out it says it cannot allocate memory. Is there any way around this so I do not have to make ajax calls for those 2 actions as it is not really necessary? On Mon, Dec 7, 2009 at 11:13 AM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Dec 7, 4:28 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > ok maybe not enough detail. > > > > When a user selects a person from a drop down selection it shows the > > user below with 2 options, to edit the user or delete the user > > > > <%= link_to_function ''Edit Contact'' do |page| > > page[:showcontact].replace_html :partial => ''/contacts/ > > ajaxshoweditcontact'' > > end %> > > > > Inside the ajaxshoweditcontact there is this link top cancel the edit: > > > > <%= button_to_function ''Cancel'' do |page| > > page[:showcontact].replace_html :partial => ''/contacts/ > > ajaxshowcontact'' > > end %> > > > > Is it generating the partials for both links when I go to the show > > page above? > > > > yes - it is generating the partials and including them in the page - > if you look at the source of the page you''d see something like > > Element.update(''showcontact'', ''long html string here'') > > Fred > > > On Dec 6, 5:46 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I have an full ajax app doing crud operations for contact info for one > > > section. I was using ajax calls to edit and cancel and also to add a > > > contact. I am implementing a button_to_function instead of doing an > > > ajax call to just edit/add/or cancel a contact. I am running into a > > > memory issue using the button_to_function or link_to_function. > > > > > I have this: > > > > > <%= link_to_function ''Edit Contact'' do |page| > > > page[:showcontact].replace_html :partial => ''/contacts/ > > > ajaxshoweditcontact'' > > > end %> > > > > > and the edit page also has this for the cancel: > > > > > _ajaxshoweditcontact.rhtml. > > > <%= button_to_function ''Cancel'' do |page| > > > page[:showcontact].replace_html :partial => ''/contacts/ > > > ajaxshowcontact'' > > > end %> > > > > > When I am trying to display the contact this: > > > _ajaxshowcontact.rhtml. > > > <%# = link_to_function ''Edit Contact'' do |page| > > > page[:showcontact].replace_html :partial => ''/contacts/ > > > ajaxshoweditcontact'' > > > end %> > > > > > is one of 2 options. > > > Rails is saying that it cannot allocate memory for this and it will > > > not even display the initial page that has the ''edit'' link. Is it > > > trying to render all of the partials before the button or link is even > > > clicked? > > > > > I am trying to cut down on the ajax calls that are not neccesary. > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.