Method: Integral::Backend::BaseController#create

Defined in:
app/controllers/integral/backend/base_controller.rb

#createObject

POST / Resource creation



57
58
59
60
61
62
63
64
65
66
67
68
# File 'app/controllers/integral/backend/base_controller.rb', line 57

def create
  add_breadcrumb I18n.t('integral.navigation.create'), "new_backend_#{controller_name.singularize}_path".to_sym
  @resource = resource_klass.new(resource_params)

  yield if block_given?

  if @resource.save
    respond_successfully(notification_message('creation_success'), send("edit_backend_#{controller_name.singularize}_path", @resource.id))
  else
    respond_failure(notification_message('creation_failure'), :new)
  end
end