I have a problem with ActiveAdmin using Ruby ruby 1.9.2p290 and Ruby on Rails 3.2.1.
I used this wiki page to setup the resource for the AdminUsers that works perfectly: Your First Admin Resource: AdminUser
After that I wanted to create the resource for my project model. The migrations for that looks like this:
class CreateProjects < ActiveRecord::Migration
def change
create_table :projects do |t|
t.string :name
t.text :description
t.boolean :isactive
t.timestamps
end
end
end
class AddSlugToProjects < ActiveRecord::Migration
def change
add_column :projects, :slug, :string
add_index :projects, :slug
end
end
My project model:
class Project < ActiveRecord::Base
scope :isactive, :conditions => ["isactive = ?",true]
extend FriendlyId
friendly_id :name, use: [:slugged, :history]
attr_accessible :name, :description, :isactive
end
And that's the project_controller:
class ProjectsController < ApplicationController
def index
#
# @projects gets filled in application_controller to be always
# available for the twitter bootstrap navbar
# @projects = Project.isactive.find(:all, :order => 'LOWER(name) asc')
#
end
def show
@project = Project.isactive.find(params[:id])
if request.path != project_path(@project)
redirect_to @project, :status => :moved_permanently
end
end
end
The admin/projects.rb is currently 'empty'
ActiveAdmin.register Project do
end
And after all that, everything I get is the following error:
Started GET "/admin/projects" for 192.168.0.2 at 2012-02-21 20:58:49 +0100
Processing by Admin::ProjectsController#index as HTML
Project Load (0.1ms) SELECT "projects".* FROM "projects" WHERE (isactive = 't') ORDER BY LOWER(name) asc
AdminUser Load (0.1ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = 2 LIMIT 1
Rendered /home/eins11/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activeadmin-0.4.1/app/views/active_admin/resource/index.html.arb (11.7ms)
Completed 500 Internal Server Error in 54ms
ActionView::Template::Error (undefined method `reorder' for #<Array:0xa3ecd44>):
1: render renderer_for(:index)
activeadmin (0.4.1) lib/active_admin/views/pages/index.rb:41:in `items_in_collection?'
activeadmin (0.4.1) lib/active_admin/views/pages/index.rb:20:in `main_content'
activeadmin (0.4.1) lib/active_admin/views/pages/base.rb:116:in `block (2 levels) in build_main_content_wrapper'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:68:in `block in build_tag'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:96:in `with_current_dom_context'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:67:in `build_tag'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:77:in `insert_tag'
activeadmin (0.4.1) lib/active_admin/arbre/html/element.rb:17:in `div'
activeadmin (0.4.1) lib/active_admin/views/pages/base.rb:115:in `block in build_main_content_wrapper'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:68:in `block in build_tag'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:96:in `with_current_dom_context'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:67:in `build_tag'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:77:in `insert_tag'
activeadmin (0.4.1) lib/active_admin/arbre/html/element.rb:17:in `div'
activeadmin (0.4.1) lib/active_admin/views/pages/base.rb:114:in `build_main_content_wrapper'
activeadmin (0.4.1) lib/active_admin/views/pages/base.rb:98:in `block in build_page_content'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:68:in `block in build_tag'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:96:in `with_current_dom_context'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:67:in `build_tag'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:77:in `insert_tag'
activeadmin (0.4.1) lib/active_admin/arbre/html/element.rb:17:in `div'
activeadmin (0.4.1) lib/active_admin/views/pages/base.rb:97:in `build_page_content'
activeadmin (0.4.1) lib/active_admin/views/pages/base.rb:41:in `block (2 levels) in build_page'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:68:in `block in build_tag'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:96:in `with_current_dom_context'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:67:in `build_tag'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:77:in `insert_tag'
activeadmin (0.4.1) lib/active_admin/arbre/html/element.rb:17:in `div'
activeadmin (0.4.1) lib/active_admin/views/pages/base.rb:38:in `block in build_page'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:96:in `with_current_dom_context'
activeadmin (0.4.1) lib/active_admin/views/pages/base.rb:37:in `build_page'
activeadmin (0.4.1) lib/active_admin/views/pages/base.rb:10:in `build'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:63:in `build_tag'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:77:in `insert_tag'
activeadmin (0.4.1) lib/active_admin/arbre/builder.rb:41:in `method_missing'
activeadmin (0.4.1) lib/active_admin/view_helpers/renderer_helper.rb:21:in `render'
activeadmin (0.4.1) app/views/active_admin/resource/index.html.arb:1:in `__home_eins____rbenv_versions_______p____lib_ruby_gems_______gems_activeadmin_______app_views_active_admin_resource_index_html_arb___523541447_100786690'
actionpack (3.2.1) lib/action_view/template.rb:143:in `block in render'
activesupport (3.2.1) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.1) lib/action_view/template.rb:141:in `render'
actionpack (3.2.1) lib/action_view/renderer/template_renderer.rb:41:in `block (2 levels) in render_template'
actionpack (3.2.1) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.1) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.1) lib/action_view/renderer/template_renderer.rb:40:in `block in render_template'
actionpack (3.2.1) lib/action_view/renderer/template_renderer.rb:48:in `render_with_layout'
actionpack (3.2.1) lib/action_view/renderer/template_renderer.rb:39:in `render_template'
actionpack (3.2.1) lib/action_view/renderer/template_renderer.rb:12:in `render'
actionpack (3.2.1) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.1) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:109:in `_render_template'
actionpack (3.2.1) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.1) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.1) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.1) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.1) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/home/eins11/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/benchmark.rb:310:in `realtime'
activesupport (3.2.1) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.1) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:39:in `render'
activeadmin (0.4.1) lib/active_admin/resource_controller/actions.rb:13:in `block (2 levels) in index'
actionpack (3.2.1) lib/action_controller/metal/responder.rb:229:in `call'
actionpack (3.2.1) lib/action_controller/metal/responder.rb:229:in `default_render'
actionpack (3.2.1) lib/action_controller/metal/responder.rb:160:in `to_html'
responders (0.6.5) lib/responders/flash_responder.rb:93:in `to_html'
actionpack (3.2.1) lib/action_controller/metal/responder.rb:153:in `respond'
actionpack (3.2.1) lib/action_controller/metal/responder.rb:146:in `call'
actionpack (3.2.1) lib/action_controller/metal/mime_responds.rb:238:in `respond_with'
inherited_resources (1.3.0) lib/inherited_resources/actions.rb:7:in `index'
activeadmin (0.4.1) lib/active_admin/resource_controller/actions.rb:11:in `index'
actionpack (3.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.1) lib/active_support/callbacks.rb:469:in `_run__639476650__process_action__1068992826__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
activerecord (3.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.1) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `dispatch'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:30:in `call'
journey (1.0.1) lib/journey/router.rb:68:in `block in call'
journey (1.0.1) lib/journey/router.rb:56:in `each'
journey (1.0.1) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `call'
sass (3.1.15) lib/sass/plugin/rack.rb:54:in `call'
warden (1.1.1) lib/warden/manager.rb:35:in `block in call'
warden (1.1.1) lib/warden/manager.rb:34:in `catch'
warden (1.1.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_support.rb:17:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…