diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb new file mode 100644 index 0000000..b247a6c --- /dev/null +++ b/app/controllers/tables_arrangements_controller.rb @@ -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 diff --git a/app/helpers/tables_arrangements_helper.rb b/app/helpers/tables_arrangements_helper.rb new file mode 100644 index 0000000..c066a2e --- /dev/null +++ b/app/helpers/tables_arrangements_helper.rb @@ -0,0 +1,2 @@ +module TablesArrangementsHelper +end diff --git a/app/views/tables_arrangements/index.html.erb b/app/views/tables_arrangements/index.html.erb new file mode 100644 index 0000000..260e144 --- /dev/null +++ b/app/views/tables_arrangements/index.html.erb @@ -0,0 +1,9 @@ +

Tables arrangements

+ +
    + <% @tables_arrangements.each_with_index do |tables_arrangement, i| %> +
  1. +

    <%= link_to "Arrangement ##{i+1}", tables_arrangement_path(tables_arrangement) %> Discomfort: <%= tables_arrangement.discomfort %>

    +
  2. + <% end %> +
\ No newline at end of file diff --git a/app/views/tables_arrangements/show.html.erb b/app/views/tables_arrangements/show.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/config/routes.rb b/config/routes.rb index fb63987..2b43138 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/lib/tasks/vns.rake b/lib/tasks/vns.rake index c33de67..c8e6b50 100644 --- a/lib/tasks/vns.rake +++ b/lib/tasks/vns.rake @@ -13,8 +13,6 @@ namespace :vns do best_solution = engine.run - binding.pry - best_solution.save! end end