class DictionaryController < ApplicationController def index @parts_of_speech = PartOfSpeech.where(language_id: active_language) @words = Word.all end def show @letter = params[:id] @words = Word.where('substr(word, 1, 1) = ?', @letter) @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") end end