Scaffold display of arrangements

This commit is contained in:
Manuel Bustillo 2024-07-24 20:43:44 +02:00
parent 191684a11c
commit 77be7d505a
6 changed files with 22 additions and 9 deletions

View File

@ -0,0 +1,9 @@
class TablesArrangementsController < ApplicationController
def index
@tables_arrangements = TablesArrangement.all.order(discomfort: :asc).limit(10)
end
def show
@tables_arrangement = TablesArrangement.find(params[:id])
end
end

View File

@ -0,0 +1,2 @@
module TablesArrangementsHelper
end

View File

@ -0,0 +1,9 @@
<h1>Tables arrangements</h1>
<ol>
<% @tables_arrangements.each_with_index do |tables_arrangement, i| %>
<li>
<p><%= link_to "Arrangement ##{i+1}", tables_arrangement_path(tables_arrangement) %> Discomfort: <%= tables_arrangement.discomfort %></p>
</li>
<% end %>
</ol>

View File

@ -1,12 +1,7 @@
Rails.application.routes.draw do
resources :guests
resources :expenses
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
resources :tables_arrangements, only: [:index, :show]
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
get "up" => "rails/health#show", as: :rails_health_check
# Defines the root path route ("/")
# root "posts#index"
get 'up' => 'rails/health#show', as: :rails_health_check
end

View File

@ -13,8 +13,6 @@ namespace :vns do
best_solution = engine.run
binding.pry
best_solution.save!
end
end