Commit placeholder work
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
class DictionaryController < ApplicationController
|
||||
def index
|
||||
@parts_of_speech = PartOfSpeech.all
|
||||
@english = Language.where(name: "English")
|
||||
@parts_of_speech = PartOfSpeech.where(language_id: @english)
|
||||
|
||||
@parts_of_speech.each do |pos|
|
||||
pos.translations.build
|
||||
end
|
||||
|
||||
@words = Word.all
|
||||
end
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
class PartOfSpeech < ApplicationRecord
|
||||
belongs_to :language
|
||||
|
||||
has_many :translations, class_name: "PartOfSpeech", foreign_key: "part_of_speech_id"
|
||||
end
|
||||
|
@@ -4,11 +4,17 @@
|
||||
<tr>
|
||||
<td><b>Part of Speech</b></td>
|
||||
<td><b>Definition</b></td>
|
||||
<% unless current_user.blank? %>
|
||||
<td><b>Translation</b></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% parts_of_speech.each do |item| %>
|
||||
<tr>
|
||||
<td><b><%= item.pos %></b></td>
|
||||
<td><%= item.definition %></td>
|
||||
<% unless current_user.blank? %>
|
||||
<td><%= item.translations.first.definition %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
Reference in New Issue
Block a user