Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Api
- module V1
- class IngredientMeasuresController < ApplicationController
- def index
- render json: IngredientMeasure.all
- end
- def create
- ingredient_measure = IngredientMeasure.new(params[:id_ingredient, :id_measure])
- if ingredient_measure.save
- render json: ingredient_measure
- else
- render json: {status: 500, err: 'Ingredient measure could not be created'}
- end
- end
- private
- def ingredient_measure_params
- params.require(:ingredient_measure).permit(:ingredient_id, :measure_id)
- end
- end
- end
- end
- {
- "measure_id" : 3,
- "ingredient_id":3
- }
Add Comment
Please, Sign In to add comment