Module: ElocalApiSupport::Actions::Create
- Defined in:
- lib/elocal_api_support/actions/create.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/elocal_api_support/actions/create.rb', line 4 def create params.permit! obj = associated_model.new(params[@model_name.to_sym]) if obj.save render json: obj else render json: { errors: obj.errors }, status: 422 end end |