Rails: view based on a different model-controller -
i using 2 different models&controllers - products , checkout, want checkout ordered product number. (meaning checkout product number 5, checkout product number 7 etc.)
how go this? should use view under products connect checkout controller , model? how can that? need configure , where? routes? other?
alternatively, should use checkout view, somehow make sure id/numbering of view based on products? how can that? need configure , where? routes? other?
for rendering checkouts dependent on associated product can following:
routes.rb
resources :checkouts checkout_controller.rb
def index @checkouts = checkout.order("product_id asc") end app/views/checkouts/index.html.erb
<% @checkouts.each |c| %> <%= c.inspect %> <% end %>
Comments
Post a Comment