Sha256: bde501847dea559f6a83137f9c0d92691e3a5400b8254b7769e37dfaa20b278d
Contents?: true
Size: 617 Bytes
Versions: 13
Compression:
Stored size: 617 Bytes
Contents
class <%= config[:class_name] %><%= " < Struct.new(:user, :#{config[:resource]})" if config[:headless] %> attr_reader :user, :<%= config[:resource] %> def initialize(user, <%= config[:resource] %>) @user = user @<%= config[:resource] %> = <%= config[:resource] %> end if ActiveRecord::Base.connection.table_exists?(:<%= config[:resource] %>_roles) <%= config[:constant] %>Role.pluck(:permission).each do |permission| define_method("#{permission}?") do <%= config[:constant] %>Role.find_by(permission: permission).send(user.role.<%= config[:resource] %>) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems