Module: Tomify::Concerns::Api::JSON
- Extended by:
- ActiveSupport::Concern
- Includes:
- Helpers
- Defined in:
- app/controllers/tomify/concerns/api/json.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
30 31 32 33 |
# File 'app/controllers/tomify/concerns/api/json.rb', line 30 def create create_record render json: { type: :success, data: data, message: "#{model_name} Created" } end |
#destroy ⇒ Object
40 41 42 43 |
# File 'app/controllers/tomify/concerns/api/json.rb', line 40 def destroy destroy_record render json: { type: :danger, message: "#{model_name} Deleted" } end |
#index ⇒ Object
20 21 22 23 |
# File 'app/controllers/tomify/concerns/api/json.rb', line 20 def index find_records render json: { type: :success, data: data } end |
#show ⇒ Object
25 26 27 28 |
# File 'app/controllers/tomify/concerns/api/json.rb', line 25 def show find_record render json: { type: :success, data: data } end |
#update ⇒ Object
35 36 37 38 |
# File 'app/controllers/tomify/concerns/api/json.rb', line 35 def update update_record render json: { type: :success, data: data, message: "#{model_name} Updated" } end |