Module: Upframework::CrudEndpoint
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/upframework/crud_endpoint.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/concerns/upframework/crud_endpoint.rb', line 32 def create if base_resource.save yield if block_given? render_serialized base_resource else render_errors base_resource.errors. end end |
#destroy ⇒ Object
42 43 44 45 |
# File 'app/controllers/concerns/upframework/crud_endpoint.rb', line 42 def destroy base_resource.destroy head :no_content end |
#index ⇒ Object
25 26 27 28 29 30 |
# File 'app/controllers/concerns/upframework/crud_endpoint.rb', line 25 def index base_resource yield if block_given? render_serialized base_resource, includes: params[:includes] end |
#show ⇒ Object
9 10 11 12 13 14 |
# File 'app/controllers/concerns/upframework/crud_endpoint.rb', line 9 def show base_resource yield if block_given? render_serialized base_resource end |
#update ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/controllers/concerns/upframework/crud_endpoint.rb', line 16 def update if base_resource.update(base_resource_params) yield if block_given? render_serialized base_resource else render_errors base_resource.errors. end end |