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

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -