module AdminIt::ActiveRecordData::NewContext
Public Class Methods
included(base)
click to toggle source
# File lib/admin_it/data/active_record/single_context.rb, line 52 def self.included(base) base.after_initialize do if child? fields(scope: :relation) .select { |f| f.assoc.klass == parent.entity_class } .each do |f| if f.assoc.collection? entity.send(f.name) << parent.entity else entity.send("#{f.name}=", parent.entity) end f.visible = false end end end end
Protected Instance Methods
load_entity(identity: nil)
click to toggle source
# File lib/admin_it/data/active_record/single_context.rb, line 71 def load_entity(identity: nil) entity = entity_class.new controller.authorize(entity, "#{name}?") if AdminIt::Env.pundit? entity end