Module: Godmin::Resources::ResourceController
- Extended by:
- ActiveSupport::Concern
- Includes:
- BatchActions
- Defined in:
- lib/godmin/resources/resource_controller.rb,
lib/godmin/resources/resource_controller/batch_actions.rb
Defined Under Namespace
Modules: BatchActions
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/godmin/resources/resource_controller.rb', line 44 def create respond_to do |format| if @resource_service.create_resource(@resource) format.html { redirect_to redirect_after_create, notice: } format.json { render :show, status: :created, location: @resource } else format.html { render :edit } format.json { render json: @resource.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/godmin/resources/resource_controller.rb', line 68 def destroy @resource_service.destroy_resource(@resource) respond_to do |format| format.html { redirect_to redirect_after_destroy, notice: } format.json { head :no_content } end end |
#edit ⇒ Object
42 |
# File 'lib/godmin/resources/resource_controller.rb', line 42 def edit; end |
#index ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/godmin/resources/resource_controller.rb', line 25 def index respond_to do |format| format.html format.json format.csv end end |
#new ⇒ Object
40 |
# File 'lib/godmin/resources/resource_controller.rb', line 40 def new; end |
#show ⇒ Object
33 34 35 36 37 38 |
# File 'lib/godmin/resources/resource_controller.rb', line 33 def show respond_to do |format| format.html format.json end end |
#update ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/godmin/resources/resource_controller.rb', line 56 def update respond_to do |format| if @resource_service.update_resource(@resource, resource_params) format.html { redirect_to redirect_after_update, notice: } format.json { render :show, status: :ok, location: @resource } else format.html { render :edit } format.json { render json: @resource.errors, status: :unprocessable_entity } end end end |