2023-10-13 00:02:22 +00:00
|
|
|
class DictionaryController < ApplicationController
|
|
|
|
def index
|
2023-12-07 16:31:54 +00:00
|
|
|
@parts_of_speech = PartOfSpeech.where(language_id: active_language)
|
2023-10-13 02:24:31 +00:00
|
|
|
@words = Word.all
|
2023-10-13 00:02:22 +00:00
|
|
|
end
|
2023-10-20 18:29:34 +00:00
|
|
|
|
|
|
|
def show
|
|
|
|
@letter = params[:id]
|
|
|
|
@words = Word.where('substr(word, 1, 1) = ?', @letter)
|
2023-12-07 16:31:54 +00:00
|
|
|
@language = active_language
|
|
|
|
|
|
|
|
#@words.joins(:definitions).where(definitions: { language_id: active_language })
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def active_language
|
|
|
|
cookies[:active_language_id] || Language.where(name: "English")
|
2023-10-20 18:29:34 +00:00
|
|
|
end
|
2023-10-13 00:02:22 +00:00
|
|
|
end
|