Rails 3.1.x 2 questions... Perhaps I am doing this too much in the raw of jquery but I can''t seem to find any other way to do these things 1 - drag_drop.js has... $.post( "groups/add_member/", { "add": ui.draggable.text() } ); which is almost everything I want but I want to add @group.id to the URL. How can I get the value of @group.id into the jquery string? 2 - my controller has ''render :partial => ''memberships'' and I have a utilities/_memberships.html.erb file but it doesn''t ''refresh'' after the change has been made. How do I ensure that the partial is refreshed? Obviously I can reload the whole page but that seems unnecessary. -- Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white-wmL3h9Ogt9Bhl2p70BpVqQ@public.gmane.orgm 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
1 down - 1 to go... can anyone toss me a bone here? On Dec 13, 2011, at 10:25 AM, Craig White wrote:> Rails 3.1.x > > 2 questions... Perhaps I am doing this too much in the raw of jquery but I can''t seem to find any other way to do these things > > 1 - drag_drop.js has... > > $.post( "groups/add_member/", { "add": ui.draggable.text() } ); > which is almost everything I want but I want to add @group.id to the URL. How can I get the value of @group.id into the jquery string?---- can''t figure out how to get @group.id from rails into the jquery string ----> 2 - my controller has ''render :partial => ''memberships'' and I have a utilities/_memberships.html.erb file but it doesn''t ''refresh'' after the change has been made. How do I ensure that the partial is refreshed? Obviously I can reload the whole page but that seems unnecessary.---- got it. needed memberships.js.erb 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 13 Dec 2011, at 21:07, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote:> 1 down - 1 to go... can anyone toss me a bone here? > > On Dec 13, 2011, at 10:25 AM, Craig White wrote: > >> Rails 3.1.x >> >> 2 questions... Perhaps I am doing this too much in the raw of jquery but I can''t seem to find any other way to do these things >> >> 1 - drag_drop.js has... >> >> $.post( "groups/add_member/", { "add": ui.draggable.text() } ); >> which is almost everything I want but I want to add @group.id to the URL. How can I get the value of @group.id into the jquery string? > ---- > can''t figure out how to get @group.id from rails into the jquery stringThese days I usually either stash things like that in the dom as data- attributes or stick a js snippet in the page that sets a global javascript variable to whatever the scripts that run on the page need to refer to Fred> ---- >> 2 - my controller has ''render :partial => ''memberships'' and I have a utilities/_memberships.html.erb file but it doesn''t ''refresh'' after the change has been made. How do I ensure that the partial is refreshed? Obviously I can reload the whole page but that seems unnecessary. > ---- > got it. > needed memberships.js.erb > > 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 Tue, Dec 13, 2011 at 6:07 PM, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote:> 1 down - 1 to go... can anyone toss me a bone here? > > On Dec 13, 2011, at 10:25 AM, Craig White wrote: > >> Rails 3.1.x >> >> 2 questions... Perhaps I am doing this too much in the raw of jquery but I can''t seem to find any other way to do these things >> >> 1 - drag_drop.js has... >> >> $.post( "groups/add_member/", { "add": ui.draggable.text() } ); >> which is almost everything I want but I want to add @group.id to the URL. How can I get the value of @group.id into the jquery string? > ---- > can''t figure out how to get @group.id from rails into the jquery stringI would put it on a ''data-*'' attribute in the view, then get it with jQuery and append it to the query string.> ---- >> 2 - my controller has ''render :partial => ''memberships'' and I have a utilities/_memberships.html.erb file but it doesn''t ''refresh'' after the change has been made. How do I ensure that the partial is refreshed? Obviously I can reload the whole page but that seems unnecessary. > ---- > got it. > needed memberships.js.erb > > 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. >-- Leonardo Mateo. There''s no place like ~ -- 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 Dec 13, 2011, at 2:44 PM, Frederick Cheung wrote:> > On 13 Dec 2011, at 21:07, Craig White <craig.white-wmL3h9Ogt9DQT0dZR+AlfA@public.gmane.org> wrote: > >> 1 down - 1 to go... can anyone toss me a bone here? >> >> On Dec 13, 2011, at 10:25 AM, Craig White wrote: >> >>> Rails 3.1.x >>> >>> 2 questions... Perhaps I am doing this too much in the raw of jquery but I can''t seem to find any other way to do these things >>> >>> 1 - drag_drop.js has... >>> >>> $.post( "groups/add_member/", { "add": ui.draggable.text() } ); >>> which is almost everything I want but I want to add @group.id to the URL. How can I get the value of @group.id into the jquery string? >> ---- >> can''t figure out how to get @group.id from rails into the jquery string > > These days I usually either stash things like that in the dom as data- attributes or stick a js snippet in the page that sets a global javascript variable to whatever the scripts that run on the page need to refer to---- the next time I read about how easy it is to use jquery I''m going to gag ;-) I finally got it... took a surprising long time to figure this one out $.post( "groups/add_member/", { "add": ui.draggable.text(), "id": ui.draggable.attr("data-add") }, function(data) { and obviously added the ''data-add'' tag to the <li> Thanks Leonardo & of course, Fred 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.