Sha256: e6b0cbb3affec3ecb1124811f50c731153e626e14f49bdcaa7867639bae8adb4

Contents?: true

Size: 540 Bytes

Versions: 3

Compression:

Stored size: 540 Bytes

Contents

module FactoryGirl
  module RemoteApi
    class FactoriesController < FactoryGirl::RemoteApi::ApplicationController
      respond_to :json

      def create
        @model = FactoryGirl.create(params[:factory], factory_attributes)
        respond_with @model
      end

      def show
        @model = FactoryGirl.attributes_for(params[:factory], factory_attributes)
        respond_with @model
      end

    private

      def factory_attributes
        params[params[:factory]].try(:except, :parent_factory)
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
factory_girl-remote_api-0.4.1 app/controllers/factory_girl/remote_api/factories_controller.rb
factory_girl-remote_api-0.4.0 app/controllers/factory_girl/remote_api/factories_controller.rb
factory_girl-remote_api-0.3.0 app/controllers/factory_girl/remote_api/factories_controller.rb