Scaffold display of arrangements
This commit is contained in:
		
							parent
							
								
									191684a11c
								
							
						
					
					
						commit
						77be7d505a
					
				
							
								
								
									
										9
									
								
								app/controllers/tables_arrangements_controller.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								app/controllers/tables_arrangements_controller.rb
									
									
									
									
									
										Normal 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 | ||||
							
								
								
									
										2
									
								
								app/helpers/tables_arrangements_helper.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								app/helpers/tables_arrangements_helper.rb
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | ||||
| module TablesArrangementsHelper | ||||
| end | ||||
							
								
								
									
										9
									
								
								app/views/tables_arrangements/index.html.erb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								app/views/tables_arrangements/index.html.erb
									
									
									
									
									
										Normal 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> | ||||
							
								
								
									
										0
									
								
								app/views/tables_arrangements/show.html.erb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								app/views/tables_arrangements/show.html.erb
									
									
									
									
									
										Normal 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 | ||||
|  | ||||
| @ -13,8 +13,6 @@ namespace :vns do | ||||
| 
 | ||||
|     best_solution = engine.run | ||||
| 
 | ||||
|     binding.pry | ||||
| 
 | ||||
|     best_solution.save! | ||||
|   end | ||||
| end | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user