Class: Backend::ActivityBudgetsController

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

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_theme

Instance Method Summary collapse

Methods inherited from BaseController

account_lettering_states_crit, accounts_range_crit, amount_range_crit, crit_params, journal_entries_states_crit, journal_letter_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name, #session_controller?

Instance Method Details

#duplicateObject


18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/backend/activity_budgets_controller.rb', line 18

def duplicate
  @activity_budget = find_and_check
  return unless @activity_budget
  activity = Activity.find_by(id: params[:activity_id])
  campaign = Campaign.find_by(id: params[:campaign_id])
  new_activity_budget = @activity_budget.duplicate!(activity, campaign)
  if params[:edit]
    redirect_to action: :edit, id: new_activity_budget.id, redirect: params[:redirect]
  else
    redirect_to params[:redirect] || { controller: :activities, action: :show, id: @activity_budget.id }
  end
end

#indexObject

No index for budgets


8
9
10
# File 'app/controllers/backend/activity_budgets_controller.rb', line 8

def index
  redirect_to controller: :activities, action: :index
end

#showObject


12
13
14
15
16
# File 'app/controllers/backend/activity_budgets_controller.rb', line 12

def show
  @activity_budget = find_and_check
  return unless @activity_budget
  redirect_to controller: :activities, action: :show, id: @activity_budget.activity_id
end