9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/dradis/plugins/content_service/notes.rb', line 9
def create_note(args={})
cat = args.fetch(:category, default_note_category)
node = args.fetch(:node, default_node_parent)
text = args.fetch(:text, default_note_text)
note = node.notes.new(
text: text,
category: cat,
author: default_author
)
if note.valid?
note.save
else
try_rescue_from_length_validation(
model: note,
field: :text,
text: text,
msg: 'Error in create_note()'
)
end
note
end
|