samedi 26 novembre 2016

How to set route for a rendered action? Rails

i'm new to mvc, rails and web development and i'm facing a problem:

I have an action(show) and a view for this action.

The view for show submits a form_tag to another action, that renders the action show.

The problem is, I have no idea how to set a route for the action that renders show.

Right now my routes.rb is:

resources :meals do
collection do
  get "meals/:id", to: "meals#show"
end

end

Tried to add these but didn't work:

match "meals/:id/calculate" , :to => "meals#calculate",:via => [:get]

and:

get "meals/:id/calculate", to => "meals#calculate"

Aucun commentaire:

Enregistrer un commentaire