From 9febb318043e5320d7338f0267c6aef651cd9315 Mon Sep 17 00:00:00 2001 From: Alberto Almagro Sotelo Date: Tue, 9 Oct 2018 23:10:07 +0200 Subject: Prevent rich_text_area from raising when inexistent attribute is passed (#24) When an inexistent attribute is passed as a parameter to currently existing Rails' Form Helpers they render an empty tag instead of raising an exception. This commit confers the same behavior to `rich_text_area`. Fixes #19 --- app/helpers/action_text/tag_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/helpers/action_text/tag_helper.rb b/app/helpers/action_text/tag_helper.rb index 103b65eb97..c7ba416880 100644 --- a/app/helpers/action_text/tag_helper.rb +++ b/app/helpers/action_text/tag_helper.rb @@ -45,7 +45,7 @@ module ActionView::Helpers end def editable_value - value.body.try(:to_trix_html) + value&.body.try(:to_trix_html) end end -- cgit v1.2.3