Sha256: d251515a022cc49c5b9117c5ad38885aff295f0711c4bceb7198d03a36f7e0f1

Contents?: true

Size: 322 Bytes

Versions: 11

Compression:

Stored size: 322 Bytes

Contents

module ElocalApiSupport
  module Actions
    module Create
      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
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
elocal_api_support-1.3.0 lib/elocal_api_support/actions/create.rb
elocal_api_support-1.2.0 lib/elocal_api_support/actions/create.rb
elocal_api_support-1.1.0 lib/elocal_api_support/actions/create.rb
elocal_api_support-1.0.0 lib/elocal_api_support/actions/create.rb
elocal_api_support-0.1.10 lib/elocal_api_support/actions/create.rb
elocal_api_support-0.1.9 lib/elocal_api_support/actions/create.rb
elocal_api_support-0.1.8 lib/elocal_api_support/actions/create.rb
elocal_api_support-0.1.7 lib/elocal_api_support/actions/create.rb
elocal_api_support-0.1.5 lib/elocal_api_support/actions/create.rb
elocal_api_support-0.1.4 lib/elocal_api_support/actions/create.rb
elocal_api_support-0.1.3 lib/elocal_api_support/actions/create.rb