ruby on rails - Unable to navigate to index action in my model -



ruby on rails - Unable to navigate to index action in my model -

ok, new rails. trying create ecommerce app scratch. defined order model track orders , orderitem model track each of order in cart. want add together button order page lets me add together more items cart. in show.html.erb order, writing next

code: <%= button_to "add cart", products_path %>

this link takes me create action of products model, instead of index action. tried alter path root_path lists products in product model, 1 time again link takes me post request instead of get, showing me error. please help!

check routes.rb file have route specific request of products model as

get "/products" => "products#index"

alternatively if have products model in app add together

resource: products

this automatically adds route index action

or else can seek this:

<%= button_to "add cart", root_path, method: :get %>

ruby-on-rails

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -