Class: Backend::TargetDistributionsController

Inherits:
BaseController show all
Defined in:
app/controllers/backend/target_distributions_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_theme

Instance Method Summary collapse

Methods inherited from BaseController

accounts_range_crit, crit_params, journal_entries_states_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name

Instance Method Details

#createObject


46
47
48
49
50
# File 'app/controllers/backend/target_distributions_controller.rb', line 46

def create
  @target_distributions = TargetDistribution.create! (permitted_params.key?(:collection) ? permitted_params[:collection].values : permitted_params).reject { |d| d['activity_production_id'].blank? }

  redirect_to params[:redirect] || backend_campaign_path('current') if @target_distributions
end

#distributeObject


52
53
54
55
# File 'app/controllers/backend/target_distributions_controller.rb', line 52

def distribute
  @target_distribution = TargetDistribution.new
  @targets = InterventionTarget.where.not(product_id: TargetDistribution.select(:target_id))
end