lib/active_admin/comments.rb in activeadmin-0.2.2 vs lib/active_admin/comments.rb in activeadmin-0.3.0
- old
+ new
@@ -4,20 +4,20 @@
require 'active_admin/comments/show_page_helper'
require 'active_admin/comments/namespace_helper'
require 'active_admin/comments/resource_helper'
# Add the comments configuration
-ActiveAdmin.extend ActiveAdmin::Comments::Configuration
+ActiveAdmin::Application.send :include, ActiveAdmin::Comments::Configuration
# Add the comments module to ActiveAdmin::Namespace
ActiveAdmin::Namespace.send :include, ActiveAdmin::Comments::NamespaceHelper
# Add the comments module to ActiveAdmin::Resource
ActiveAdmin::Resource.send :include, ActiveAdmin::Comments::ResourceHelper
# Add the module to the show page
-ActiveAdmin.view_factory.show_page.send :include, ActiveAdmin::Comments::ShowPageHelper
+ActiveAdmin.application.view_factory.show_page.send :include, ActiveAdmin::Comments::ShowPageHelper
# Generate a Comment resource when namespaces are registered
ActiveAdmin::Event.subscribe ActiveAdmin::Namespace::RegisterEvent do |namespace|
if namespace.comments?
namespace.register ActiveAdmin::Comment, :as => 'Comment' do
@@ -34,10 +34,10 @@
filter :body
filter :created_at
# Only view comments in this namespace
scope :all, :default => true do |comments|
- comments.where(:namespace => active_admin_config.namespace.name)
+ comments.where(:namespace => active_admin_config.namespace.name.to_s)
end
# Always redirect to the resource on show
before_filter :only => :show do
flash[:notice] = flash[:notice].dup if flash[:notice]