From: "mame (Yusuke Endoh)" Date: 2012-10-30T22:51:28+09:00 Subject: [ruby-core:48594] [ruby-trunk - Bug #4508] Ability class for CanCan for Rails Issue #4508 has been updated by mame (Yusuke Endoh). Description updated Hello, I'm closing this ticket as "worksforme". I guess that OP talked about "cancan" gem. I installed it and tried the script, but it terminated successfully: $ gem install cancan $ ruby -rcancan t.rb $ I think that OP was gone, so I believe we cannot make any progress. Please reopen this ticket if anyone has any clue. -- Yusuke Endoh ---------------------------------------- Bug #4508: Ability class for CanCan for Rails https://bugs.ruby-lang.org/issues/4508#change-31986 Author: tobiaspreuss (Tobias Preuss) Status: Feedback Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] =begin ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux] ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] When I use the following CanCan::Ability class, Ruby dies. class Ability include CanCan::Ability def initialize(user) alias_action :index, :show, :list, :to => :read alias_action :new, :create, :to => :create alias_action :edit, :update, :to => :update alias_action :delete, :to => :destroy #user ||= User.new # Guest user (not logged in). can :read, :all if user if user.is_admin? puts "\n\nCurrent user #{user.email} is an admin.\n" can :manage, :all else puts "\n\nCurrent user #{user.email} is NO admin.\n" # Study. can [:create, :new], [Study, Facility, Subject] can [:update, :destroy, :delete], [Study], :student => user end end end end =end -- http://bugs.ruby-lang.org/