Skip to content

Commit

Permalink
Add nil check to serializer for invalid categories
Browse files Browse the repository at this point in the history
  • Loading branch information
d-m-u committed Feb 5, 2018
1 parent 74e132d commit 60fde31
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/dialog_field_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def serialize(dialog_field, all_attributes = false)

if dialog_field.type == "DialogFieldTagControl"
category = Category.find_by(:id => dialog_field.category)
dialog_field.options.merge!(:category_name => category.name, :category_description => category.description)
dialog_field.options.merge!(:category_name => category.name, :category_description => category.description) if category
end
included_attributes(dialog_field.as_json(:methods => [:type, :values]), all_attributes).merge(extra_attributes)
end
Expand Down

0 comments on commit 60fde31

Please sign in to comment.