Module: AdminAssistant::Request

Defined in:
lib/admin_assistant/request/new.rb,
lib/admin_assistant/request/base.rb,
lib/admin_assistant/request/edit.rb,
lib/admin_assistant/request/show.rb,
lib/admin_assistant/request/index.rb,
lib/admin_assistant/request/create.rb,
lib/admin_assistant/request/update.rb,
lib/admin_assistant/request/destroy.rb,
lib/admin_assistant/request/autocomplete.rb

Defined Under Namespace

Classes: AbstractNew, AbstractSaving, Autocomplete, Base, CreateSaving, Destroy, Edit, Index, MultiCreate, MultiNew, ParamsForSave, Show, SingleCreate, SingleNew, Update

Class Method Summary collapse

Class Method Details

.dispatch(action_name, admin_assistant, controller) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/admin_assistant/request/base.rb', line 3

def self.dispatch(action_name, admin_assistant, controller)
  class_name = action_name.to_s.capitalize
  if [:create, :new].include?(action_name)
    if admin_assistant.form_settings.multi?
      class_name = "Multi#{class_name}"
    else
      class_name = "Single#{class_name}"
    end
  end
  const_get(class_name).new(admin_assistant, controller).call
end