Skip to content
Browse files

Refactored up ActiveAdmin::Comments::Views::Comments#comment_form_url

* Removed the string checking of "root". Instead use the root? method.
* Only call send if we have to, in the case of the comments_path we
  can just call the method.
  • Loading branch information...
1 parent cfed37c commit 0e5aa91035c4b531da6981417241a11b5e2aa4a5 @gregbell gregbell committed Oct 13, 2011
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/active_admin/comments/views/active_admin_comments.rb
View
9 lib/active_admin/comments/views/active_admin_comments.rb
@@ -55,9 +55,12 @@ def build_empty_message
end
end
- def comment_form_url # modified to allow for no default_namespace or :root default_namespace
- send_path = active_admin_namespace.name.to_s == "root" ? "comments_path" : "#{active_admin_namespace.name}_comments_path"
- send(:"#{send_path}")
+ def comment_form_url
+ if active_admin_namespace.root?
+ comments_path
+ else
+ send(:"#{active_admin_namespace.name}_comments_path")
+ end
end
def build_comment_form

0 comments on commit 0e5aa91

Please sign in to comment.
Something went wrong with that request. Please try again.