Why don't you try it out :) Yes it must work, but are you passing the
product / item id to be added and the quantity to be added?

On Tue, Nov 15, 2016 at 4:47 AM, Joe Guerra <jgue...@jginfosys.com> wrote:

> Hi,
>
> I'm trying to run a method in one of my controllers using a button_to
> command.  How is this accomplished?
>
> So far, I've got <%= button_to "Add to Cart", action: "add_to_cart" %> in
> my products page
>
> I defined a add_to_cart in my product controller, and created a route for
> it.
>
> Am I on the right track?  Will it execute code in that method in that
> controller?
>
> Thanks,
> Joe
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/rubyonrails-talk/28e7bbb6-bd2c-4661-a5e3-
> 8663135aef27%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/28e7bbb6-bd2c-4661-a5e3-8663135aef27%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Karthikeyan A K
http://thepro.in/profiles/karthikeyan-a-k-1

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAJR%2B9kZyA5eMw2aY6zW8npppYFe7JgW_WqsRkmyQTk3LT%2B1wtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to