Deep integration with CanCan

Showing 1-22 of 22 messages
Deep integration with CanCan James McKinney 7/5/12 7:52 AM
I added the following content to this wiki page: https://github.com/gregbell/active_admin/wiki/How-to-work-with-cancan

If you want deep integration between CanCan and ActiveAdmin, put this gist (https://gist.github.com/3040303) in a Rails initializer. What it will do for you:

        • It will properly load and authorize all your resources.
        • Menus will only appear if the current user has the ability to access those resources.
        • On the index page, only the actions (links in rightmost column) that the current user has the ability to perform will appear.
        • On all resource pages, only the action items (buttons in top-right) that the current user has the ability to perform will appear.
        • If you use ActiveAdmin's auto_link helper, it will only create a link if the current user has the ability to view that resource.

Re: Deep integration with CanCan Awea 7/5/12 7:54 AM
Many thanks :)

Le jeudi 5 juillet 2012 16:52:39 UTC+2, James McKinney a écrit :
Re: Deep integration with CanCan Joseh-Henrique Caetano de Brito e Silva 7/6/12 2:04 PM
Gave error when using. Check and see that is the version I'm using 0.4.4 Activeadmin, summarizing it did not work :-(

Sorry for my English


Em quinta-feira, 5 de julho de 2012 11h52min39s UTC-3, James McKinney escreveu:
Re: [Active Admin] Deep integration with CanCan James McKinney 7/6/12 2:54 PM
What error did it give you?

You still need to set up CanCan first to use this initializer.

1. Add CanCan to your Gemfile

gem 'cancan'

2. Generate and edit an Ability class

rails generate cancan:ability

3. Add this code to your Application Controller

rescue_from CanCan::AccessDenied do |exception|
  respond_to do |format|
    format.html do
      redirect_to admin_root_path, :alert => exception.message
    end
  end
end

def current_ability
  @current_ability ||= Ability.new(current_admin_user)
end
Re: [Active Admin] Deep integration with CanCan James McKinney 7/6/12 3:37 PM
What error did it give you?

You still need to set up CanCan first to use this initializer.

1. Add CanCan to your Gemfile

gem 'cancan'

2. Generate and edit an Ability class

rails generate cancan:ability

3. Add this code to your Application Controller

rescue_from CanCan::AccessDenied do |exception|
  respond_to do |format|
    format.html do
      redirect_to admin_root_path, :alert => exception.message
    end
  end
end

def current_ability
  @current_ability ||= Ability.new(current_admin_user)
end

On 2012-07-06, at 5:04 PM, Joseh-Henrique Caetano de Brito e Silva wrote:


Re: [Active Admin] Deep integration with CanCan Joseh-Henrique Caetano de Brito e Silva 7/7/12 6:47 AM


Em sexta-feira, 6 de julho de 2012 18h54min38s UTC-3, James McKinney escreveu:
What error did it give you?
James the error that appears is this:
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:234:in `load': C:/Users/joseh/dev/sites/rails/arquivo/config/initializers/activeadmin-cancan.rb:68: syntax error, unexpected kDO, expecting kEND (SyntaxError)
C:/Users/joseh/dev/sites/rails/arquivo/config/initializers/activeadmin-cancan.rb:75: syntax error, unexpected kDO, expecting kEND
C:/Users/joseh/dev/sites/rails/arquivo/config/initializers/activeadmin-cancan.rb:82: syntax error, unexpected kDO, expecting kEND
C:/Users/joseh/dev/sites/rails/arquivo/config/initializers/activeadmin-cancan.rb:89: syntax error, unexpected kEND, expecting $end

The legacy code is different from the version 0.4.4 here. Comparing the code:

activeadmin-0.4.4\lib\active_admin\resource\action_items.rb

def add_default_action_items
  # New Link on all actions except :new and :show
  add_action_item :except => [:new, :show] do
  if controller.action_methods.include?('new')
    link_to(I18n.t('active_admin.new_model', :model => active_admin_config.resource_name), new_resource_path)
...

You code

arquivo\config\initializers\activeadmin-cancan.rb
def add_default_action_items
  # New Link on all actions except :new and :show
  add_action_item :except => [:new, :show], :if => proc{ can? :create, active_admin_config.resource_class } do
    if controller.action_methods.include?('new')
      link_to(I18n.t('active_admin.new_model', :model => active_admin_config.resource_label), new_resource_path)
...



You still need to set up CanCan first to use this initializer.
From the beginning I've used the cancan, just wanted more control (automatic) to define the actions.
I had the gem activeadmin-cancan https://github.com/11factory/activeadmin-cancan cancan. I disabled it to use what you created.


1. Add CanCan to your Gemfile

gem 'cancan'

2. Generate and edit an Ability class

rails generate cancan:ability
Ok. already exist

3. Add this code to your Application Controller

rescue_from CanCan::AccessDenied do |exception|
  respond_to do |format|
    format.html do
      redirect_to admin_root_path, :alert => exception.message
    end
  end
end

my code

  rescue_from CanCan::AccessDenied do |exception|
    redirect_to dashboard_path, :alert => exception.message
  end
 
def current_ability
  @current_ability ||= Ability.new(current_admin_user)
end
ok. Already exist 
Re: [Active Admin] Deep integration with CanCan James McKinney 7/7/12 8:02 AM
Those errors are from the Ruby parser. I had only tested in Ruby 1.9. I added parentheses and it should work now in Ruby 1.8: https://gist.github.com/3040303

And yes, the code is different, because I'm making changes to the code to integrate with CanCan!

It's important to remove https://github.com/11factory/activeadmin-cancan like you did.
Re: [Active Admin] Deep integration with CanCan Joseh-Henrique Caetano de Brito e Silva 7/7/12 9:35 AM
How nice that our conversation is progressing :-)

After updating the code done for you, given some access to the application after login.

But there's always a but,

NameError (uninitialized constant Dashboard):

Rendered C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/actionpack-3.1.6/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/actionpack-3.1.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
Rendered C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/actionpack-3.1.6/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (21.0ms)

My versions
rails 3.1.6
activeadmin 0.4.4
ruby 1.8.7


Em sábado, 7 de julho de 2012 12h02min31s UTC-3, James McKinney escreveu:
Re: [Active Admin] Deep integration with CanCan James McKinney 7/7/12 9:44 AM
Hmm, my code doesn't refer to Dashboard. Not sure what's happening there. Is that the full stack trace? What's the URL path where that happens?
Re: [Active Admin] Deep integration with CanCan Joseh-Henrique Caetano de Brito e Silva 7/7/12 9:54 AM
Bellow - Full Trace

activesupport (3.1.6) lib/active_support/inflector/methods.rb:113:in `constantize'
activesupport (3.1.6) lib/active_support/inflector/methods.rb:112:in `each'
activesupport (3.1.6) lib/active_support/inflector/methods.rb:112:in `constantize'
activesupport (3.1.6) lib/active_support/core_ext/string/inflections.rb:43:in `constantize'
cancan (1.6.7) lib/cancan/controller_resource.rb:141:in `resource_class'
cancan (1.6.7) lib/cancan/controller_resource.rb:148:in `resource_class_with_parent'
cancan (1.6.7) lib/cancan/controller_resource.rb:41:in `authorize_resource'
cancan (1.6.7) lib/cancan/controller_resource.rb:10:in `send'
cancan (1.6.7) lib/cancan/controller_resource.rb:10:in `_callback_before_31'
activesupport (3.1.6) lib/active_support/callbacks.rb:448:in `_run__199081855__process_action__199225275__callbacks'
activesupport (3.1.6) lib/active_support/callbacks.rb:386:in `send'
activesupport (3.1.6) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks'
activesupport (3.1.6) lib/active_support/callbacks.rb:81:in `send'
activesupport (3.1.6) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.6) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.1.6) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.1.6) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.1.6) lib/active_support/notifications.rb:53:in `instrument'
activesupport (3.1.6) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.6) lib/active_support/notifications.rb:53:in `instrument'
actionpack (3.1.6) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.1.6) lib/action_controller/metal/params_wrapper.rb:201:in `process_action'
activerecord (3.1.6) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.1.6) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.1.6) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.1.6) lib/action_controller/metal.rb:193:in `dispatch'
actionpack (3.1.6) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.1.6) lib/action_controller/metal.rb:236:in `action'
actionpack (3.1.6) lib/action_dispatch/routing/route_set.rb:71:in `call'
actionpack (3.1.6) lib/action_dispatch/routing/route_set.rb:71:in `dispatch'
actionpack (3.1.6) lib/action_dispatch/routing/route_set.rb:35:in `call'
rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:in `call'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:96:in `recognize'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:75:in `optimized_each'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:95:in `recognize'
rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:in `call'
actionpack (3.1.6) lib/action_dispatch/routing/route_set.rb:538:in `call'
sass (3.1.19) lib/sass/./sass/plugin/rack.rb:54:in `call'
warden (1.1.1) lib/warden/manager.rb:35: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.1.6) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.3.6) lib/rack/etag.rb:23:in `call'
rack (1.3.6) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.1.6) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.1.6) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.1.6) lib/action_dispatch/middleware/flash.rb:243:in `call'
rack (1.3.6) lib/rack/session/abstract/id.rb:195:in `context'
rack (1.3.6) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.6) lib/action_dispatch/middleware/cookies.rb:331:in `call'
activerecord (3.1.6) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
actionpack (3.1.6) lib/action_dispatch/middleware/callbacks.rb:29:in `call'
activesupport (3.1.6) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
activesupport (3.1.6) lib/active_support/callbacks.rb:81:in `send'
activesupport (3.1.6) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.6) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (3.1.6) lib/action_dispatch/middleware/reloader.rb:68:in `call'
rack (1.3.6) lib/rack/sendfile.rb:101:in `call'
actionpack (3.1.6) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.1.6) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.6) lib/rails/rack/logger.rb:13:in `call_without_quiet_assets'
quiet_assets (1.0.1) lib/quiet_assets.rb:20:in `call'
rack (1.3.6) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.6) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.6) lib/rack/lock.rb:15:in `call'
actionpack (3.1.6) lib/action_dispatch/middleware/static.rb:61:in `call'
railties (3.1.6) lib/rails/engine.rb:456:in `call'
railties (3.1.6) lib/rails/application.rb:143:in `call'
rack (1.3.6) lib/rack/content_length.rb:14:in `call'
railties (3.1.6) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.3.6) lib/rack/handler/webrick.rb:59:in `service'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:162:in `start'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:95:in `start'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:92:in `each'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:92:in `start'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:23:in `start'
C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.3.6) lib/rack/handler/webrick.rb:13:in `run'
rack (1.3.6) lib/rack/server.rb:265:in `start'
railties (3.1.6) lib/rails/commands/server.rb:70:in `start'
railties (3.1.6) lib/rails/commands.rb:54
railties (3.1.6) lib/rails/commands.rb:49:in `tap'
railties (3.1.6) lib/rails/commands.rb:49
script/rails:6:in `require'
script/rails:6
-e:1:in `load'
-e:1



Em sábado, 7 de julho de 2012 13h44min35s UTC-3, James McKinney escreveu:
Re: [Active Admin] Deep integration with CanCan James McKinney 7/7/12 10:07 AM
And what's the URL path/what page are you trying to load?
Re: [Active Admin] Deep integration with CanCan Joseh-Henrique Caetano de Brito e Silva 7/7/12 10:19 AM
The activeadmin is the main application, after accessing the login, the system falls into the Dashboard, normal pattern of activeadmin.

It is as it should be, the home screen after login to access -> Dashboard

http://localhost:3000/users/login (Login main access)
after login
http://localhost:3000 (Dashboard)

Remember
C:\Users\joseh\dev\sites\rails\arquivo\config\initializers\active_admin.rb
..
 config.default_namespace = false
..

Em sábado, 7 de julho de 2012 14h07min23s UTC-3, James McKinney escreveu:
Re: [Active Admin] Deep integration with CanCan James McKinney 7/7/12 10:24 AM
Not sure why it's not working. If you remove the initializer, does it work?
Re: [Active Admin] Deep integration with CanCan Joseh-Henrique Caetano de Brito e Silva 7/7/12 10:31 AM
Yes, normally

Em sábado, 7 de julho de 2012 14h24min07s UTC-3, James McKinney escreveu:
Re: [Active Admin] Deep integration with CanCan James McKinney 7/7/12 10:44 AM
Try adding this to your dashboard.rb file inside the main block

controller.skip_authorize_resource :only => :index
Re: [Active Admin] Deep integration with CanCan Joseh-Henrique Caetano de Brito e Silva 7/7/12 10:53 AM
Err,

ActiveAdmin::Dashboards.build do
  controller.skip_authorize_resource :only => :index
...

Error
  controller.skip_authorize_resource :only => :index
C:/Users/joseh/dev/sites/rails/arquivo/app/admin/dashboards.rb:3: undefined local variable or method `controller' for ActiveAdmin::Dashboards:Module (NameError)
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/dashboards.rb:24:in `module_eval'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/dashboards.rb:24:in `build'
    from C:/Users/joseh/dev/sites/rails/arquivo/app/admin/dashboards.rb:1

Remember:
gem 'activeadmin', '0.4.4'


Em sábado, 7 de julho de 2012 14h44min34s UTC-3, James McKinney escreveu:
Re: [Active Admin] Deep integration with CanCan James McKinney 7/7/12 11:06 AM
Ah, you're using the old, deprecated ActiveAdmin dashboards class. You need to switch to new style of using pages instead, e.g.

ActiveAdmin.register_page 'Dashboard' do
...
end

And for pages you don't need to add that skip_authorize_resource line.
Re: [Active Admin] Deep integration with CanCan Joseh-Henrique Caetano de Brito e Silva 7/7/12 11:20 AM
C:\Users\joseh>gem list | grep activeadmin
File STDIN:
activeadmin (0.4.4)

My GemFile

source 'http://rubygems.org'

gem 'rails', '3.1.6'

gem 'activeadmin', '0.4.4'
gem "meta_search",    '>= 1.1.0.pre'
gem 'json'

# workaround
gem 'execjs'
gem 'therubyracer', :platform => :ruby 
gem 'sass-rails',   '~> 3.1.5'

group :assets do
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem 'delocalize'
gem 'cancan'
#gem 'activeadmin-cancan', '0.1.2'
gem 'tlsmail'

group :development, :test do
  gem 'mysql2'
  gem 'annotate'
  gem 'quiet_assets'
end

group :production do
  gem 'rubyfb'
end

Excuse me, I may be wrong, but the version I use is ActiveAdmin gem 0.4.4 and not the GitHub, see the error below.

=> Ctrl-C to shutdown server
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/namespace.rb:140:in `register_page_controller': (eval):1:in `register_page_controller': superclass mismatch for class DashboardController (TypeError)
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/namespace.rb:71:in `eval'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/namespace.rb:140:in `register_page_controller'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/namespace.rb:71:in `register_page'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/application.rb:128:in `register_page'
    from C:0:in `__send__'
    from C:0:in `register_page'
    from C:/Users/joseh/dev/sites/rails/arquivo/app/admin/dashboards.rb:2
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:234:in `load'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:234:in `load'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:223:in `load_dependency'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:223:in `load_dependency'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:234:in `load'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/application.rb:161:in `load!'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/application.rb:161:in `each'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/application.rb:161:in `load!'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/application.rb:187:in `routes'
    from C:0:in `__send__'
    from C:0:in `routes'
    from C:/Users/joseh/dev/sites/rails/arquivo/config/routes.rb:11
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/actionpack-3.1.6/lib/action_dispatch/routing/route_set.rb:264:in `instance_exec'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/actionpack-3.1.6/lib/action_dispatch/routing/route_set.rb:264:in `eval_block'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/actionpack-3.1.6/lib/action_dispatch/routing/route_set.rb:241:in `draw'
    from C:/Users/joseh/dev/sites/rails/arquivo/config/routes.rb:1
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:234:in `load'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:234:in `load'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:223:in `load_dependency'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:223:in `load_dependency'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:234:in `load'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/application/routes_reloader.rb:29:in `load_paths'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/application/routes_reloader.rb:29:in `each'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/application/routes_reloader.rb:29:in `load_paths'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/application/routes_reloader.rb:13:in `reload!'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/application.rb:87:in `reload_routes!'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/reloader.rb:34:in `reload!'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/reloader.rb:97:in `reload!'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/reloader.rb:92:in `initialize'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/file_update_checker.rb:32:in `call'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/reloader.rb:83:in `execute_if_updated'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activeadmin-0.4.4/lib/active_admin/reloader.rb:109:in `_callback_before_17'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/callbacks.rb:404:in `_run_prepare_callbacks'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/callbacks.rb:81:in `send'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/actionpack-3.1.6/lib/action_dispatch/middleware/reloader.rb:46:in `prepare!'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/application/finisher.rb:41
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/initializable.rb:30:in `instance_exec'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/initializable.rb:30:in `run'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/initializable.rb:55:in `run_initializers'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/initializable.rb:54:in `each'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/initializable.rb:54:in `run_initializers'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/application.rb:96:in `initialize!'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/railtie/configurable.rb:30:in `send'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.1.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from C:/Users/joseh/dev/sites/rails/arquivo/config/environment.rb:5
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:240:in `require'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:240:in `require'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:223:in `load_dependency'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:223:in `load_dependency'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:240:in `require'
    from C:/Users/joseh/dev/sites/rails/arquivo/config.ru:4
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval'
    from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize'
    from C:/Users/joseh/dev/sites/rails/arquivo/config.ru:1:in `new'
    from C:/Users/joseh/dev/sites/rails/arquivo/config.ru:1
Exiting

Process finished with exit code 1

Em sábado, 7 de julho de 2012 15h06min52s UTC-3, James McKinney escreveu:...
Re: [Active Admin] Deep integration with CanCan James McKinney 7/7/12 11:31 AM
You may have to upgrade to:








</blockquo
...
Re: [Active Admin] Deep integration with CanCan Joseh-Henrique Caetano de Brito e Silva 7/7/12 11:42 AM
I agree with you in upgrading to the development version on GitHub, but what about the other users? Who want to use your tip and are using the gem 0.4.4, will have a problem. In this case you'd better fix the tip on the Wiki.

Actually, I would use your tip, with the gem installed and stable. For even expect Grebell put ActiveAdmin updated with more features and clear, stable, looks like it will take. :-(

Meanwhile, it will update and I'll be without your great tip. :-(


Em sábado, 7 de julho de 2012 15h31min57s UTC-3, James McKinney escreveu:...
Re: [Active Admin] Deep integration with CanCan James McKinney 7/7/12 12:03 PM
I'm not sure I understand. 0.4.4 is two months old. ActiveAdmin has currently been publishing point-releases every few months, so I'm sure there will be a 0.4.5 soon. The gist will work with 0.4.5.

Anyway, the error may not even have anything to do with my gist. I'd have to see ALL your code to debug it properly, or you can try to debug it yourself.
...
Re: [Active Admin] Deep integration with CanCan Joseh-Henrique Caetano de Brito e Silva 7/7/12 12:07 PM
Thanks for your reply. Do you understand my bad English. :-) Thanks again

Em sábado, 7 de julho de 2012 16h03min15s UTC-3, James McKinney escreveu:








C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:234:in `load': C:/Users/joseh/dev/sites/rails/arquivo/config/initializers/activeadmin-cancan.rb:68: syntax error, unexpected kDO, expecting kEND (
...
More topics »