Module: RecordsControllerBehavior
- Extended by:
- ActiveSupport::Concern
- Included in:
- RecordsController
- Defined in:
- app/controllers/concerns/records_controller_behavior.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/concerns/records_controller_behavior.rb', line 33 def create set_attributes respond_to do |format| if resource.save format.html { redirect_to redirect_after_create, notice: 'Object was successfully created.' } format.json { render json: object_as_json, status: :created, location: redirect_after_create } else format.html { new } format.json { render json: resource.errors, status: :unprocessable_entity } end end end |
#edit ⇒ Object
28 29 30 31 |
# File 'app/controllers/concerns/records_controller_behavior.rb', line 28 def edit @form = build_form render 'records/edit' end |
#new ⇒ Object
23 24 25 26 |
# File 'app/controllers/concerns/records_controller_behavior.rb', line 23 def new @form = build_form render 'records/new' end |
#update ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/concerns/records_controller_behavior.rb', line 46 def update set_attributes respond_to do |format| if resource.save format.html { redirect_to redirect_after_update, notice: 'Object was successfully updated.' } format.json { head :no_content } else format.html { edit } format.json { render json: resource.errors, status: :unprocessable_entity } end end end |