104
105
106
107
108
109
110
111
112
|
# File 'lib/models/word.rb', line 104
def create(word:, pronunciation:, meaning:, example:, context: nil, target_language: nil,
translation_to_target_language: nil)
result = Services::DB.instance.execute('INSERT INTO words (word, pronunciation, meaning, example, context, target_language, translation_to_target_language) VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING *',
[word, pronunciation, meaning, example, context, target_language,
translation_to_target_language]).first
new(id: result[0], word: result[1], pronunciation: result[2], meaning: result[3], example: result[4],
context: result[5], target_language: result[6], translation_to_target_language: result[7])
end
|