class Conversation < ActiveRecord::Base
protect do |user|
can :create
can :read
can :update
can :destroy
end
enum status: [ :active, :archived ]
end
#
c = Conversation.restrict!(current_user).find 1
# Works fine and save value to the db
c.active!
# return nil instead of status enum value
c.status
# return false in every case instead of true/false dependent on status
c.active?
# returns the integer number of the enum value, just fine
c["status"]
Reading within insecure blocks or unrestricted Objects works fine.
Reading within insecure blocks or unrestricted Objects works fine.
http://edgeguides.rubyonrails.org/4_1_release_notes.html#active-record-enums src for enums https://github.com/rails/rails/blob/4-1-stable/activerecord/lib/active_record/enum.rb