16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/dradis/plugins/content_service/content_blocks.rb', line 16
def create_content_block(args={})
block_group = args.fetch(:block_group, default_content_block_group)
content = args.fetch(:content, default_content_block_content)
state = args.fetch(:state, :published)
user_id = args.fetch(:user_id)
content_block = ContentBlock.new(
content: content,
block_group: block_group,
project_id: project.id,
state: state,
user_id: user_id
)
if content_block.valid?
content_block.save
return content_block
else
try_rescue_from_length_validation(
model: content_block,
field: :content,
text: content,
msg: 'Error in create_content_block()',
tail: plugin_details
)
end
end
|