Module: Undercarriage::Controllers::Restful::Actions::CreateConcern
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/undercarriage/controllers/restful/actions/create_concern.rb
Overview
Create restful action
Instance Method Summary collapse
-
#create ⇒ Object
Create action.
Instance Method Details
#create ⇒ Object
Create action
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/undercarriage/controllers/restful/actions/create_concern.rb', line 41 def create nested_resource_pre_build respond_to do |format| if @create_resource.save after_create_action format.html do flash[flash_status_type] = redirect_to location_after_create end format.json { render :show, status: :created, location: location_after_create } else nested_resource_build format.html { render :new, status: unprocessable_status } format.json { render json: @create_resource.errors, status: unprocessable_status } end end end |