class Object
Public Instance Methods
create()
click to toggle source
Redirect to the resource show page after comment creation
# File lib/active_admin/orm/active_record/comments.rb, line 64 def create create! do |success, failure| success.html do redirect_back fallback_location: active_admin_root end failure.html do flash[:error] = I18n.t 'active_admin.comments.errors.empty_text' redirect_back fallback_location: active_admin_root end end def destroy destroy! do |success, failure| success.html do redirect_back fallback_location: active_admin_root end failure.html do redirect_back fallback_location: active_admin_root end end end end
destroy()
click to toggle source
# File lib/active_admin/orm/active_record/comments.rb, line 75 def destroy destroy! do |success, failure| success.html do redirect_back fallback_location: active_admin_root end failure.html do redirect_back fallback_location: active_admin_root end end end
scoped_collection()
click to toggle source
Prevent N+1 queries
Calls superclass method
# File lib/active_admin/orm/active_record/comments.rb, line 59 def scoped_collection super.includes(:author, :resource) end