Created
June 17, 2014 11:05
-
-
Save StasKoval/5b6fedc9c3ca0e54e640 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Permission < ActiveRecord::Base | |
serialize :metadata, Hash | |
#bitmask :some_attribute, :as => [:value1, :value2] | |
attr_accessible :action, :role, :subject_class , :metadata | |
rails_admin do | |
configure :block, :metadata | |
end | |
# rails_admin do | |
# edit do | |
# field :some_attribute, :enum do | |
# | |
#=begin | |
# enum_method do | |
# :some_attribute | |
# end | |
#=end | |
# | |
# enum do | |
# binding.pry | |
# Hash[abstract_model.model.bitmasks[:some_attribute].map { |k,v| [k.humanize.titleize, v] }] | |
# end | |
# | |
# pretty_value do | |
# bindings[:object].send(name).map{|v| v.to_s.humanize.titleize }.join(', ') | |
# end | |
# | |
# def form_value | |
# bindings[:object].send(name) | |
# end | |
# | |
# # set this to true for multi-select | |
# multiple do | |
# true | |
# end | |
# | |
# end | |
# | |
# end | |
# | |
# end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment