{"action":"created","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/378","repository_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project","labels_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/378/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/378/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/378/events","html_url":"https://github.com/ga-wdi-boston/full-stack-project/issues/378","id":172291104,"number":378,"title":"getting 201 on curl POST request but data is returning null/nil","user":{"login":"cdelsoin","id":20059077,"avatar_url":"https://avatars.githubusercontent.com/u/20059077?v=3","gravatar_id":"","url":"https://api.github.com/users/cdelsoin","html_url":"https://github.com/cdelsoin","followers_url":"https://api.github.com/users/cdelsoin/followers","following_url":"https://api.github.com/users/cdelsoin/following{/other_user}","gists_url":"https://api.github.com/users/cdelsoin/gists{/gist_id}","starred_url":"https://api.github.com/users/cdelsoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdelsoin/subscriptions","organizations_url":"https://api.github.com/users/cdelsoin/orgs","repos_url":"https://api.github.com/users/cdelsoin/repos","events_url":"https://api.github.com/users/cdelsoin/events{/privacy}","received_events_url":"https://api.github.com/users/cdelsoin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2016-08-20T21:12:04Z","updated_at":"2016-08-22T04:19:29Z","closed_at":null,"body":"When I try to post to my db everything returns nil. \r\n\r\n```\r\naudio-project-api_development=# \\d presets\r\n                                     Table \"public.presets\"\r\n   Column   |            Type             |                      Modifiers                       \r\n------------+-----------------------------+------------------------------------------------------\r\n id         | integer                     | not null default nextval('presets_id_seq'::regclass)\r\n name       | character varying           | \r\n rain       | numeric                     | \r\n fire       | numeric                     | \r\n thunder    | numeric                     | \r\n crickets   | numeric                     | \r\n birds      | numeric                     | \r\n coffee     | numeric                     | \r\n waves      | numeric                     | \r\n bowl       | numeric                     | \r\n created_at | timestamp without time zone | not null\r\n updated_at | timestamp without time zone | not null\r\n user_id    | integer                     | \r\nIndexes:\r\n    \"presets_pkey\" PRIMARY KEY, btree (id)\r\n    \"index_presets_on_user_id\" btree (user_id)\r\nForeign-key constraints:\r\n    \"fk_rails_b75d4175fa\" FOREIGN KEY (user_id) REFERENCES users(id)\r\n\r\naudio-project-api_development=# \\q\r\n~/wdi/projects/audio-project/audio-project (master)$ curl --include --request \"POST\" \"http://localhost:3000/presets\" \\\r\n>         --header \"Content-Type: application/json\" \\\r\n>         --data $'{\r\n>           \"preset\": {\r\n>             \"name\": 1,\r\n>             \"rain\": 1,\r\n>             \"fire\": 1,\r\n>             \"thunder\": 1,\r\n>             \"crickets\": 1,\r\n>             \"birds\": 1,\r\n>             \"coffee\": 1,\r\n>             \"waves\": 1,\r\n>             \"bowl\": 1,\r\n>             \"user\": 1\r\n>           }\r\n>         }'\r\nHTTP/1.1 201 Created \r\nX-Frame-Options: SAMEORIGIN\r\nX-Xss-Protection: 1; mode=block\r\nX-Content-Type-Options: nosniff\r\nLocation: http://localhost:3000/presets/23\r\nContent-Type: application/json; charset=utf-8\r\nVary: Origin\r\nEtag: W/\"ca17543a8deb7fa59fc9debae4ab3592\"\r\nCache-Control: max-age=0, private, must-revalidate\r\nX-Request-Id: 241702a2-b879-4b1a-b6a2-e9c17afcdb11\r\nX-Runtime: 0.009560\r\nServer: WEBrick/1.3.1 (Ruby/2.3.1/2016-04-26)\r\nDate: Sat, 20 Aug 2016 00:31:51 GMT\r\nContent-Length: 166\r\nConnection: Keep-Alive\r\n\r\n{\"preset\":{\"id\":23,\"name\":null,\"rain\":null,\"fire\":null,\"thunder\":null,\"crickets\":null,\"birds\":null,\"coffee\":null,\"waves\":null,\"bowl\":null,\"user_id\":null,\"user\":null}}\r\n```"},"comment":{"url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/comments/241312046","html_url":"https://github.com/ga-wdi-boston/full-stack-project/issues/378#issuecomment-241312046","issue_url":"https://api.github.com/repos/ga-wdi-boston/full-stack-project/issues/378","id":241312046,"user":{"login":"cdelsoin","id":20059077,"avatar_url":"https://avatars.githubusercontent.com/u/20059077?v=3","gravatar_id":"","url":"https://api.github.com/users/cdelsoin","html_url":"https://github.com/cdelsoin","followers_url":"https://api.github.com/users/cdelsoin/followers","following_url":"https://api.github.com/users/cdelsoin/following{/other_user}","gists_url":"https://api.github.com/users/cdelsoin/gists{/gist_id}","starred_url":"https://api.github.com/users/cdelsoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdelsoin/subscriptions","organizations_url":"https://api.github.com/users/cdelsoin/orgs","repos_url":"https://api.github.com/users/cdelsoin/repos","events_url":"https://api.github.com/users/cdelsoin/events{/privacy}","received_events_url":"https://api.github.com/users/cdelsoin/received_events","type":"User","site_admin":false},"created_at":"2016-08-22T04:19:29Z","updated_at":"2016-08-22T04:19:29Z","body":"OMFG I just removed `if params[:presets]` and it worked! User and user_id are still null so ill keep the issue open in case I have trouble getting it to work \r\n\r\n```\r\nStarted POST \"/presets/\" for ::1 at 2016-08-22 00:13:48 -0400\r\nProcessing by PresetsController#create as */*\r\n  Parameters: {\"preset\"=>{\"name\"=>\"dasds\", \"rain\"=>\"0.5\", \"fire\"=>\"0.5\", \"thunder\"=>\"0.5\", \"crickets\"=>\"0.5\", \"birds\"=>\"0.5\", \"coffee\"=>\"0.5\", \"waves\"=>\"0.5\", \"bowl\"=>\"0.5\"}}\r\n   (0.1ms)  BEGIN\r\n  SQL (30.8ms)  INSERT INTO \"presets\" (\"name\", \"rain\", \"fire\", \"thunder\", \"crickets\", \"birds\", \"coffee\", \"waves\", \"bowl\", \"created_at\", \"updated_at\") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING \"id\"  [[\"name\", \"dasds\"], [\"rain\", \"0.5\"], [\"fire\", \"0.5\"], [\"thunder\", \"0.5\"], [\"crickets\", \"0.5\"], [\"birds\", \"0.5\"], [\"coffee\", \"0.5\"], [\"waves\", \"0.5\"], [\"bowl\", \"0.5\"], [\"created_at\", \"2016-08-22 04:13:48.540449\"], [\"updated_at\", \"2016-08-22 04:13:48.540449\"]]\r\n   (0.8ms)  COMMIT\r\n[active_model_serializers] Rendered PresetSerializer with ActiveModelSerializers::Adapter::Json (6.52ms)\r\nCompleted 201 Created in 60ms (Views: 9.8ms | ActiveRecord: 32.8ms)\r\n\r\n```\r\n\r\n![screen shot 2016-08-22 at 12 18 53 am](https://cloud.githubusercontent.com/assets/20059077/17843618/16c68d4c-67fe-11e6-9203-aec12a17130d.png)\r\n"}}
{"actor":{"display_login":"cdelsoin"}}