Add dictionary controller with index route
This commit is contained in:
		
							
								
								
									
										5
									
								
								app/controllers/dictionary_controller.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/controllers/dictionary_controller.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
class DictionaryController < ApplicationController
 | 
			
		||||
  def index
 | 
			
		||||
    @parts_of_speech = PartOfSpeech.all
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										2
									
								
								app/helpers/dictionary_helper.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								app/helpers/dictionary_helper.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
module DictionaryHelper
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										2
									
								
								app/models/part_of_speech.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								app/models/part_of_speech.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
class PartOfSpeech < ApplicationRecord
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										17
									
								
								app/views/dictionary/index.html.erb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								app/views/dictionary/index.html.erb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
<h1>Dictionary#index</h1>
 | 
			
		||||
<p>Find me in app/views/dictionary/index.html.erb</p>
 | 
			
		||||
 | 
			
		||||
<p><%= @parts_of_speech.count %> parts of speech entries in database</p>
 | 
			
		||||
<h1>Parts of Speech</h1>
 | 
			
		||||
<table>
 | 
			
		||||
  <tr>
 | 
			
		||||
    <td><b>Part of Speech</b></td>
 | 
			
		||||
    <td><b>Definition</b></td>
 | 
			
		||||
  </tr>
 | 
			
		||||
<% @parts_of_speech.each do |item| %>
 | 
			
		||||
  <tr>
 | 
			
		||||
    <td><%= item.pos %></td>
 | 
			
		||||
    <td><%= item.definition %></td>
 | 
			
		||||
  </tr>
 | 
			
		||||
<% end %>
 | 
			
		||||
</table>
 | 
			
		||||
		Reference in New Issue
	
	Block a user