From 75181e9cf44c2275c9cc055de4cc9ffb3bd802e7 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 28 Sep 2015 20:19:24 +0200 Subject: [PATCH] adds consistency and speed to auxiliary methods --- app/controllers/concerns/commentable.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/concerns/commentable.rb b/app/controllers/concerns/commentable.rb index d245588fa..364a9fdda 100644 --- a/app/controllers/concerns/commentable.rb +++ b/app/controllers/concerns/commentable.rb @@ -61,12 +61,12 @@ module Commentable @commentable ||= instance_variable_get("@#{commentable_name}") end - def commentable_model - @commentable_model ||= commentable_name.capitalize.constantize + def commentable_name + @commentable_name ||= controller_name.singularize end - def commentable_name - controller_name.singularize + def commentable_model + @commentable_model ||= commentable_name.capitalize.constantize end def set_commentable_instance