I have a rails 3.1 app and I am curious how you would do something. I have a link_to remote option true button <%=link_to "Add to your Favorites", add_favorite_url(movie_star),:class=>"btn small primary" %> I need to submit this to the users controller via ajax do some stuff then set the button to say that the favorite has been added. Can you please tell me how you would accomplish this I have a method def add_user_to_favorites end Thank You -- 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.
rule of thumb is get it working first without ajax... then add remote true to the button or link, then add your ajax... jordan On Jan 23, 2012, at 8:29 PM, gerbdla wrote:> I have a rails 3.1 app and I am curious how you would do something. > > I have a link_to remote option true button > <%=link_to "Add to your Favorites", > add_favorite_url(movie_star),:class=>"btn small primary" %> > > I need to submit this to the users controller via ajax do some stuff > then set the button to say > that the favorite has been added. > > Can you please tell me how you would accomplish this > > I have a method > def add_user_to_favorites > > end > > Thank You > > -- > 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. >-- 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.
Thank you I did just that now it works On Jan 23, 5:36 pm, Jordan Miller <jrdn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> rule of thumb is get it working first without ajax... then add remote true to the button or link, then add your ajax... > > jordan > > On Jan 23, 2012, at 8:29 PM, gerbdla wrote: > > > > > > > > > I have a rails 3.1 app and I am curious how you would do something. > > > I have a link_to remote option true button > > <%=link_to "Add to your Favorites", > > add_favorite_url(movie_star),:class=>"btn small primary" %> > > > I need to submit this to the users controller via ajax do some stuff > > then set the button to say > > that the favorite has been added. > > > Can you please tell me how you would accomplish this > > > I have a method > > def add_user_to_favorites > > > end > > > Thank You > > > -- > > 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 athttp://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.