Hi Guys, Sb could help me in this problem? I have an partial that I pass some parameters... I need to create many partials by click event of a link, How can I do that? I tried to do like this way But it does''nt work... $("#addContactLink").bind("click", function(){ $("#partialtestdiv").append("<%=render :partial=>''shared/user_contacts'',:locals=>{:f=>f},:object=>resource.user_contacts %>"); } ); -- Bruno Meira -- 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 Fri, Dec 23, 2011 at 12:01 PM, Bruno Meira <goesmeira-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Guys, > Sb could help me in this problem? > I have an partial that I pass some parameters... > I need to create many partials by click event of a link, How can I do that? > > I tried to do like this way > But it does''nt work...Do you get an error, or just no text in partialtestdiv?> > $("#addContactLink").bind("click", > function(){ > $("#partialtestdiv").append("<%=render > :partial=>''shared/user_contacts'',:locals=>{:f=>f},:object=>resource.user_contacts > %>"); > } > ); > -- > Bruno Meira > > > -- > 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.-- Greg Akins http://twitter.com/akinsgre -- 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.
No errors appears just a pure html is inserted in div: <%=render :partial=>''shared/user_contacts'',:locals=>{:f=>f},:object=>resource.user_contacts %> -- 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.
the html is similar of the inserted partial in div -- 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 Bruno, On Fri, Dec 23, 2011 at 11:01 AM, Bruno Meira <goesmeira-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Guys, > Sb could help me in this problem? > I have an partial that I pass some parameters... > I need to create many partials by click event of a link, How can I do that? > > I tried to do like this way > But it does''nt work... > > $("#addContactLink").bind("click", > function(){ > $("#partialtestdiv").append("<%=render > :partial=>''shared/user_contacts'',:locals=>{:f=>f},:object=>resource.user_contacts > %>"); > } > );The onclick is executing in the browser so you''re not going to be able to use erb in it. You''ll want to make an ajax call (.load is a handy shortcut for this) to the server where you can render the partial using erb to get the html you need returned. 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.
Hmmmm.... Ok, I will try do this using an ajax call... But How can I pass object references using an ajax call? Is it possible in rails or I need pass object attributes by JSON? Thx :D -- 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 Fri, Dec 23, 2011 at 11:12 AM, Bruno Meira <goesmeira-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hmmmm.... > Ok, I will try do this using an ajax call... > But How can I pass object references using an ajax call? Is it possible in > rails or I need pass object attributes by JSON?I believe that''s what the ''data'' argument of the .load function is supposed to be used for. Make a simple test using a string and see what you get in the params hash on the server. Best regards, 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 Fri, Dec 23, 2011 at 11:19 AM, Bill Walton <bwalton.im-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Fri, Dec 23, 2011 at 11:12 AM, Bruno Meira <goesmeira-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Hmmmm.... >> Ok, I will try do this using an ajax call... >> But How can I pass object references using an ajax call? Is it possible in >> rails or I need pass object attributes by JSON? > > I believe that''s what the ''data'' argument of the .load function is > supposed to be used for. Make a simple test using a string and see > what you get in the params hash on the server.If you''re not already using them, I find both the Firebug and Live HTTP Headers plug-ins indispensable for exploring ajax calls. 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.
Ok!! I will take a look better in these parameters. I''m using default chrome developers js debug. Is Firebug better? thx for the help ;D -- 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 Fri, Dec 23, 2011 at 12:08 PM, Bruno Meira <goesmeira-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ok!! > I will take a look better in these parameters. > I''m using default chrome developers js debug. Is Firebug better? > thx for the help ;DI do all my dev work in Firefox because of the tools. I hear Chrome is catching up but don''t have any experience there yet. 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.