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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -