Class: RemoteFactoryGirlHomeRails::HomeController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/remote_factory_girl_home_rails/home_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
# File 'app/controllers/remote_factory_girl_home_rails/home_controller.rb', line 8

def create 
  if RemoteFactoryGirlHomeRails.enabled?
    resource = FactoryGirl.create(factory(params), attributes(params))
    render json: Serializer.serialize(resource)
  else
    forbidden = 403
    render json: { status: forbidden }, status: forbidden 
  end
end

#indexObject



18
19
20
21
# File 'app/controllers/remote_factory_girl_home_rails/home_controller.rb', line 18

def index
  factories = FactoryGirl.factories.map(&:name)
  render json: { factories: factories }
end