PermissionsController def add_member ...snip... @permissions = Permission.all respond_to do |format| format.html { flash[:messages1] = @permission.user.name + " has been given rights." } format.js end end app/views/permissions/add_member.js.erb $(''#privileges'').replaceWith("<%= escape_javascript(render(@permissions)) %>"); view (_permissions.html.erb with some snippage of extraneous things) <div id="privileges"> <div id="messages1" class="round"> <%= flash[:messages1].html_safe %> </div> <div class="block" id="users" align="left"> <ul id="priv_users" class="ui-widget-header" align="left"> <% for u in @users -%><li id="moveable-<%= u.id %>" class="ui-widget-content" data-add="<%= u.id %>"><%= u.uid %></li><% end -%> </ul> </div> </div> </div> <p>Missing template permissions/add_member, application/add_member with {:locale=>[:en, :en], :handlers=>[:coffee, :builder, :erb], :formats=>[:html]}. Searched in: * "/home/users/cwhite/tti_framework/app/views" </p> and if I rename app/views/permissions/add_member.js.erb to add_member.erb, I get a different error... Showing <i>/home/users/cwhite/tti_framework/app/views/permissions/add_member.erb</i> where line <b>#1</b> raised: <pre><code>Missing partial permissions/permission with {:locale=>[:en, :en], :handlers=>[:coffee, :builder, :erb], :formats=>[:html]}. Searched in: * "/home/users/cwhite/tti_framework/app/views" </code></pre> Been stuck on this for too long now... what obvious thing am I missing? -- Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com Need help communicating between generations at work to achieve your desired success? Let us help! -- 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.
Hi Craig, On Thu, Jan 5, 2012 at 4:18 PM, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote:> > <p>Missing template ... :formats=>[:html]}.That looks like a clue. Have you checked your request header? HTH, Bill -- 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.
On Jan 5, 2012, at 3:37 PM, Bill Walton wrote:> Hi Craig, > > On Thu, Jan 5, 2012 at 4:18 PM, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote: >> >> <p>Missing template ... :formats=>[:html]}. > > That looks like a clue. Have you checked your request header?---- I think so... I''ve been staring at firebug and even copied the errors out of firebug and this looks like it wants to respond to html and not js and in fact, I enabled it to ''render :partial => "permissions"'' and it clearly wants to respond with html and not js. my js is a bit involved... $(function() { $("#priv_users").on("mouseenter", function() { !$("li:first", this).hasClass("ui-draggable") && $("li", this).draggable(); }); $("[id^=privileges-]").droppable({ drop: function(event, ui) { $(this).addClass("ui-state-highlight"); $.post("/permissions/add_member/", { "uid": ui.draggable.attr("data-add"), "id": $(this).attr("id") }, function(data) { var html = $(data); $("#messages1").replaceWith(html.closest("#messages1")); }); } }); }) Craig -- 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.
On Thu, Jan 5, 2012 at 4:44 PM, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote:> > On Jan 5, 2012, at 3:37 PM, Bill Walton wrote: > >> Hi Craig, >> >> On Thu, Jan 5, 2012 at 4:18 PM, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote: >>> >>> <p>Missing template ... :formats=>[:html]}. >> >> That looks like a clue. Have you checked your request header? > ---- > I think so... I''ve been staring at firebug and even copied the errors out of firebug and this looks like it wants to respond to html and not js and in fact, I enabled it to ''render :partial => "permissions"'' and it clearly wants to respond with html and not js.Then my best advice would be to double check the accepts header using Live Http Headers. You may need to do some explicit setup prior to the post. Bill> my js is a bit involved... > > $(function() { > $("#priv_users").on("mouseenter", function() { > !$("li:first", this).hasClass("ui-draggable") && $("li", this).draggable(); > }); > $("[id^=privileges-]").droppable({ > drop: function(event, ui) { > $(this).addClass("ui-state-highlight"); > $.post("/permissions/add_member/", { > "uid": ui.draggable.attr("data-add"), > "id": $(this).attr("id") > }, function(data) { > var html = $(data); > $("#messages1").replaceWith(html.closest("#messages1")); > }); > } > }); > }) > > Craig > > -- > 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. >-- 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.
On Jan 5, 2012, at 3:57 PM, Bill Walton wrote:> On Thu, Jan 5, 2012 at 4:44 PM, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote: >> >> On Jan 5, 2012, at 3:37 PM, Bill Walton wrote: >> >>> Hi Craig, >>> >>> On Thu, Jan 5, 2012 at 4:18 PM, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote: >>>> >>>> <p>Missing template ... :formats=>[:html]}. >>> >>> That looks like a clue. Have you checked your request header? >> ---- >> I think so... I''ve been staring at firebug and even copied the errors out of firebug and this looks like it wants to respond to html and not js and in fact, I enabled it to ''render :partial => "permissions"'' and it clearly wants to respond with html and not js. > > Then my best advice would be to double check the accepts header using > Live Http Headers. You may need to do some explicit setup prior to > the post.---- wish I understood what you are trying to tell me here Craig -- 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.
On Thu, Jan 5, 2012 at 5:18 PM, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote:> > app/views/permissions/add_member.js.erb > $(''#privileges'').replaceWith("<%= escape_javascript(render(@permissions)) > %>"); >Sorry if my question is not about the main problem but, could you explain why are you using .replaceWith()? Usually I use $("#myDiv").html("<%= escape_javascript(render "partial", locals)%> Do you find replaceWith() better than html() ?? Thanks in advance Javier -- 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.
On Jan 5, 2012, at 4:41 PM, Javier Quarite wrote:> > > On Thu, Jan 5, 2012 at 5:18 PM, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote: > > app/views/permissions/add_member.js.erb > $(''#privileges'').replaceWith("<%= escape_javascript(render(@permissions)) %>"); > > Sorry if my question is not about the main problem but, could you explain why are you using .replaceWith()? > > Usually I use $("#myDiv").html("<%= escape_javascript(render "partial", locals)%> > > Do you find replaceWith() better than html() ?? > > Thanks in advance---- actually I am using replaceWith in some places in my js code itself but the code in add_member.js.erb isn''t getting executed at all and it''s responding to html instead. Craig -- 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.
On Thu, Jan 5, 2012 at 5:26 PM, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote:> > On Jan 5, 2012, at 3:57 PM, Bill Walton wrote: >> >> Then my best advice would be to double check the accepts header using >> Live Http Headers. You may need to do some explicit setup prior to >> the post. > ---- > wish I understood what you are trying to tell me hereMy apologies. Not sure which part of the three above I should address, so here''s all three. 1) Rails decides which respond_to block to use based on the request''s Accept header. Here''s a link that should help on that front. http://www.gethifi.com/blog/browser-rest-http-accept-headers 2) Live HTTP is a plugin for Firefox that shows you the headers for each request-response cycle. I''ve pasted in the first frame you''ll get visiting the link above below. It''s got 2 sections. The first shows the headers sent on the request. The second shows the headers sent on the response. The Accept header content is on the 4th line of the request section. In this case, the client is telling the server that its first preference is for html and you can see from 2nd line in the response section that that is what the server sends back. GET /blog/browser-rest-http-accept-headers HTTP/1.1 Host: www.gethifi.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.24) Gecko/20111107 Ubuntu/10.04 (lucid) Firefox/3.6.24 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Referer: http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&ved=0CDwQFjAC&url=http%3A%2F%2Fwww.gethifi.com%2Fblog%2Fbrowser-rest-http-accept-headers&ei=9z4GT6y7K4X-sQKd25SRCg&usg=AFQjCNFXKdbpcUNstr0O0jkYtWvhb4EjYQ&sig2=Ycrt2dIClGHE4IldZUeJzw Cookie: __utma=1.1465277256.1325809449.1325809449.1325809449.1; __utmb=1.1.10.1325809449; __utmc=1; __utmz=1.1325809449.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); __lo__roomid=2489 Cache-Control: max-age=0 HTTP/1.1 200 OK Content-Type: text/html Expires: Thu, 05 Jan 12 19:20:20 -0500 Cache-Control: max-age=60 Vary: Accept-Encoding Content-Encoding: gzip Content-Length: 21416 Accept-Ranges: bytes Date: Fri, 06 Jan 2012 00:25:13 GMT Connection: keep-alive 3) If what you see from looking at what''s produced in Live HTTP by your post is that the request''s Accept header is not requesting javascript (text/script iirc) then the problem is explained. The ''fix'' is to set the request''s Accept header. I did a quick google on ''jquery ajax set header'' and got good results. This one looked like a good place to start. http://snipplr.com/view/9869/ This one might be a good look if the one above doesn''t get you the results you need. http://stackoverflow.com/questions/1145588/cannot-properly-set-the-accept-http-header-with-jquery HTH, Bill -- 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.
On Jan 5, 2012, at 5:52 PM, Bill Walton wrote:> On Thu, Jan 5, 2012 at 5:26 PM, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote: >> >> On Jan 5, 2012, at 3:57 PM, Bill Walton wrote: >>> >>> Then my best advice would be to double check the accepts header using >>> Live Http Headers. You may need to do some explicit setup prior to >>> the post. >> ---- >> wish I understood what you are trying to tell me here > > My apologies. Not sure which part of the three above I should > address, so here''s all three. > > 1) Rails decides which respond_to block to use based on the request''s > Accept header. Here''s a link that should help on that front. > http://www.gethifi.com/blog/browser-rest-http-accept-headers > > 2) Live HTTP is a plugin for Firefox that shows you the headers for > each request-response cycle. I''ve pasted in the first frame you''ll > get visiting the link above below. It''s got 2 sections. The first > shows the headers sent on the request. The second shows the headers > sent on the response. The Accept header content is on the 4th line of > the request section. In this case, the client is telling the server > that its first preference is for html and you can see from 2nd line in > the response section that that is what the server sends back. > > > GET /blog/browser-rest-http-accept-headers HTTP/1.1 > > Host: www.gethifi.com > > User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.24) > Gecko/20111107 Ubuntu/10.04 (lucid) Firefox/3.6.24 > > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 > > Accept-Language: en-us,en;q=0.5 > > Accept-Encoding: gzip,deflate > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > Keep-Alive: 115 > > Connection: keep-alive > > Referer: http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&ved=0CDwQFjAC&url=http%3A%2F%2Fwww.gethifi.com%2Fblog%2Fbrowser-rest-http-accept-headers&ei=9z4GT6y7K4X-sQKd25SRCg&usg=AFQjCNFXKdbpcUNstr0O0jkYtWvhb4EjYQ&sig2=Ycrt2dIClGHE4IldZUeJzw > > Cookie: __utma=1.1465277256.1325809449.1325809449.1325809449.1; > __utmb=1.1.10.1325809449; __utmc=1; > __utmz=1.1325809449.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); > __lo__roomid=2489 > > Cache-Control: max-age=0 > > > > HTTP/1.1 200 OK > > Content-Type: text/html > > Expires: Thu, 05 Jan 12 19:20:20 -0500 > > Cache-Control: max-age=60 > > Vary: Accept-Encoding > > Content-Encoding: gzip > > Content-Length: 21416 > > Accept-Ranges: bytes > > Date: Fri, 06 Jan 2012 00:25:13 GMT > > Connection: keep-alive > > > 3) If what you see from looking at what''s produced in Live HTTP by > your post is that the request''s Accept header is not requesting > javascript (text/script iirc) then the problem is explained. The > ''fix'' is to set the request''s Accept header. I did a quick google on > ''jquery ajax set header'' and got good results. This one looked like a > good place to start. > http://snipplr.com/view/9869/ > > This one might be a good look if the one above doesn''t get you the > results you need. > http://stackoverflow.com/questions/1145588/cannot-properly-set-the-accept-http-header-with-jquery > > HTH---- Probably does help but this is my ''side'' project at work - done on my slack time and I have had my hands full so I didn''t get any time to do much with it but I wanted to acknowledge your e-mail, say thanks but it may be a few more days before I get the time to go through it all. Craig -- 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.