module ActionPlugin::Mixin

Public Instance Methods

format_opts(opts) click to toggle source
# File lib/action_plugin/mixin.rb, line 13
def format_opts opts
  opts.extract!(:subject_id, :subject_type, :action_type, :target_type, :target_id)
end
validate_opts(opts = {}) click to toggle source
# File lib/action_plugin/mixin.rb, line 5
def validate_opts opts = {}
  return false if opts[:subject].blank? || opts[:action_type].blank?
  return false if opts[:target_id].blank? || opts[:target_type].blank?
  opts[:subject_id]   = opts[:subject].id
  opts[:subject_type] = opts[:subject].class.name
  opts
end