class SocMed::Services::Blocks::BlockBase
Private Instance Methods
block()
click to toggle source
# File lib/soc_med/services/blocks/block_base.rb, line 10 def block block = owner.blockable_objects.find_by(target: target) raise ActiveRecord::RecordNotFound unless block block end
owner()
click to toggle source
# File lib/soc_med/services/blocks/block_base.rb, line 30 def owner owner_type, owner_id = owner_info owner = SocMed.owner_class.find_by(id: owner_id) raise ActiveRecord::RecordNotFound unless owner owner end
owner_info()
click to toggle source
# File lib/soc_med/services/blocks/block_base.rb, line 38 def owner_info return params[:block][:owner_type], params[:block][:owner_id] unless params[:block].nil? return params[:owner_type], params[:owner_id] end
target()
click to toggle source
# File lib/soc_med/services/blocks/block_base.rb, line 17 def target target_type, target_id = target_info target = target_type.classify.constantize.find_by(id: target_id) raise ActiveRecord::RecordNotFound unless target target end
target_info()
click to toggle source
# File lib/soc_med/services/blocks/block_base.rb, line 25 def target_info return params[:block][:target_type], params[:block][:target_id] unless params[:block].nil? return params[:target_type], params[:target_id] end