Return word inflections
This commit is contained in:
parent
f74bfce7a8
commit
a427b048d9
1 changed files with 6 additions and 1 deletions
7
main.rb
7
main.rb
|
@ -32,6 +32,7 @@ get '/words/:id' do
|
|||
part_of_speech: context.part_of_speech_name(word_id),
|
||||
commentary: word_info[:commentary],
|
||||
translations: context.translations(word_id),
|
||||
inflections: word_info[:inflections],
|
||||
examples: context.examples(word_id),
|
||||
})
|
||||
end
|
||||
|
@ -79,7 +80,7 @@ public
|
|||
word_id = Integer word_id
|
||||
|
||||
row = @db_conn.exec_params(
|
||||
'SELECT primary_form, commentary FROM words WHERE id = $1',
|
||||
'SELECT primary_form, commentary, inflections FROM words WHERE id = $1',
|
||||
[word_id],
|
||||
).to_a.first
|
||||
|
||||
|
@ -89,9 +90,13 @@ public
|
|||
commentary = String(row['commentary']).strip.freeze
|
||||
commentary = nil if commentary.empty?
|
||||
|
||||
inflections = String(row['inflections']).strip.freeze
|
||||
inflections = nil if inflections.empty?
|
||||
|
||||
{
|
||||
primary_form: primary_form,
|
||||
commentary: commentary,
|
||||
inflections: inflections,
|
||||
}.freeze
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue