centro/smokestack_engine — pull request #1 by tmertens (2014-03-19 04:04:02+00:00)
Title: Spike

@jdfrens @jwood @albertosaurus

Here is a very first try at a spike for the smokestack rails engine. Thanks @albertosaurus for the help today! After some work on this and a small patch in the base smokestack library, I have basic integration for `FactoryGirl.create` working.

Take a look, most importantly at create_controller, which is VERY simple. You can give it a try:

```
bundle install
bundle exec rake app:db:migrate
bundle exec rake app:db:test:prepare
cd spec/test_app
bundle exec rails server
```

Using a REST client such as Postman in Chrome, make a request to create a user using the :user factory in the test_app:

**URL:** `http://0.0.0.0:3000/smokestack_engine/api/create.json`
**Method:** `POST`
**Headers:** `{'Content-Type' => 'application/json'}`
**Raw Body:** `{"factory": ["user", {"username": "Jimmy_Buffet"}]}`

FactoryGirl will generate the object with the `:user` factory and supplied options, then smokestack_engine responds with the JSON representation of the generated object:

```
{"id":6,"username":"Jimmy_Buffet","first_name":"John","last_name":"Doe","last_login":"2014-03-18T14:54:19.000Z","created_at":"2014-03-19T03:42:57.746Z","updated_at":"2014-03-19T03:42:57.746Z"}
```