Q:

heroku error but not on local server NoMethodError (undefined method `user_id='

having in issue on heroku but not my local server below are my heroku logs. 
The error happened after I created a user/listings association..I am not having this error on my local server though..I have raked the heroku DB but still not having any luck..any help would be much appreciated!  
$ heroku logs
Your version of git is 1.9.4.. Which has serious security vulnerabilities. 
More information here: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x
2015-12-19T02:24:20.445251+00:00 app[web.1]:   app/controllers/listings_controller.rb:28:in `create'
2015-12-19T02:24:20.445252+00:00 app[web.1]:
2015-12-19T02:24:20.445252+00:00 app[web.1]:
2015-12-19T02:24:23.088493+00:00 heroku[router]: at=info method=POST path="/users/sign_out" host=yahozzle.herokuapp.com request_id=3c4b0c96-b71f-4ebd-9661-a91beb3b3bd8 fwd="98.111.222.34" dyno=web.1 connect=1ms service=16ms status=302 bytes=918
2015-12-19T02:24:23.154612+00:00 heroku[router]: at=info method=GET path="/" host=yahozzle.herokuapp.com request_id=08fd59c2-3629-4e41-93a5-ea156049881e fwd="98.111.222.34" dyno=web.1 connect=2ms service=14ms status=200 bytes=3031
2015-12-19T02:24:23.079628+00:00 app[web.1]: Started DELETE "/users/sign_out" for 98.111.222.34 at 2015-12-19 02:24:23 +0000
2015-12-19T02:24:23.150758+00:00 app[web.1]: Processing by ListingsController#index as HTML
2015-12-19T02:24:23.155748+00:00 app[web.1]:   Rendered layouts/_header.html.erb (0.6ms)
2015-12-19T02:24:23.155975+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.0ms)
2015-12-19T02:24:23.156182+00:00 app[web.1]: Completed 200 OK in 5ms (Views: 2.6ms | ActiveRecord: 2.2ms)
2015-12-19T02:24:23.082600+00:00 app[web.1]: Processing by Devise::SessionsController#destroy as HTML
2015-12-19T02:24:23.082623+00:00 app[web.1]:   Parameters: {"authenticity_token"=>"F4C91AjGJl1l6CKsJqN0XOnlh1jVLcgamFDg6KHFAgQ="}
2015-12-19T02:24:23.090805+00:00 app[web.1]: Redirected to https://yahozzle.herokuapp.com/
2015-12-19T02:24:23.090951+00:00 app[web.1]: Completed 302 Found in 8ms (ActiveRecord: 5.0ms)
2015-12-19T02:24:23.148071+00:00 app[web.1]: Started GET "/" for 98.111.222.34 at 2015-12-19 02:24:23 +0000
2015-12-19T02:24:23.154538+00:00 app[web.1]:   Rendered listings/index.html.erb within layouts/application (2.7ms)
2015-12-19T02:24:25.282999+00:00 heroku[router]: at=info method=GET path="/users/sign_up" host=yahozzle.herokuapp.com request_id=273fceae-16bc-4b0d-9a97-2615e33380ed fwd="98.111.222.34" dyno=web.1 connect=1ms service=14ms status=200 bytes=3683
2015-12-19T02:24:25.283889+00:00 app[web.1]:   Rendered devise/shared/_links.html.erb (0.2ms)
2015-12-19T02:24:25.283962+00:00 app[web.1]:   Rendered devise/registrations/new.html.erb within layouts/application (3.0ms)
2015-12-19T02:24:25.276661+00:00 app[web.1]: Started GET "/users/sign_up" for 98.111.222.34 at 2015-12-19 02:24:25 +0000
2015-12-19T02:24:25.285315+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.0ms)
2015-12-19T02:24:25.285117+00:00 app[web.1]:   Rendered layouts/_header.html.erb (0.5ms)
2015-12-19T02:24:25.285518+00:00 app[web.1]: Completed 200 OK in 6ms (Views: 4.9ms | ActiveRecord: 0.0ms)
2015-12-19T02:24:25.279451+00:00 app[web.1]: Processing by Devise::RegistrationsController#new as HTML
2015-12-19T02:24:40.278717+00:00 heroku[router]: at=info method=POST path="/users" host=yahozzle.herokuapp.com request_id=4a99566b-d84c-4cfe-aa22-2f54b2ae99c0 fwd="98.111.222.34" dyno=web.1 connect=5ms service=106ms status=302 bytes=1172
2015-12-19T02:24:40.183162+00:00 app[web.1]: Started POST "/users" for 98.111.222.34 at 2015-12-19 02:24:40 +0000
2015-12-19T02:24:40.330892+00:00 app[web.1]: Processing by ListingsController#index as HTML
2015-12-19T02:24:40.337656+00:00 app[web.1]:   Rendered layouts/_header.html.erb (2.9ms)
2015-12-19T02:24:40.185794+00:00 app[web.1]: Processing by Devise::RegistrationsController#create as HTML
2015-12-19T02:24:40.185825+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"ydnYz/AwvfPd/Pgq7giMJdNN7jvz99EJr6o23GToNrE=", "user"=>{"name"=>"Jesse Jones", "email"=>"jesse@aol.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
2015-12-19T02:24:40.281062+00:00 app[web.1]: Redirected to https://yahozzle.herokuapp.com/
2015-12-19T02:24:40.281199+00:00 app[web.1]: Completed 302 Found in 95ms (ActiveRecord: 14.6ms)
2015-12-19T02:24:40.328477+00:00 app[web.1]: Started GET "/" for 98.111.222.34 at 2015-12-19 02:24:40 +0000
2015-12-19T02:24:40.334231+00:00 app[web.1]:   Rendered listings/index.html.erb within layouts/application (2.3ms)
2015-12-19T02:24:40.337864+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.0ms)
2015-12-19T02:24:40.338061+00:00 app[web.1]: Completed 200 OK in 7ms (Views: 2.7ms | ActiveRecord: 3.7ms)
2015-12-19T02:24:40.335421+00:00 heroku[router]: at=info method=GET path="/" host=yahozzle.herokuapp.com request_id=a1abe949-489a-4ac3-982c-29572cfb82ed fwd="98.111.222.34" dyno=web.1 connect=2ms service=14ms status=200 bytes=3228
2015-12-19T02:24:41.850817+00:00 heroku[router]: at=info method=GET path="/listings/new" host=yahozzle.herokuapp.com request_id=433af8e9-4484-475d-a77b-a683770f1924 fwd="98.111.222.34" dyno=web.1 connect=1ms service=28ms status=200 bytes=3840
2015-12-19T02:24:41.828639+00:00 app[web.1]: Started GET "/listings/new" for 98.111.222.34 at 2015-12-19 02:24:41 +0000
2015-12-19T02:24:41.836641+00:00 app[web.1]:   Rendered listings/_form.html.erb (3.5ms)
2015-12-19T02:24:41.836798+00:00 app[web.1]:   Rendered listings/new.html.erb within layouts/application (3.9ms)
2015-12-19T02:24:41.840626+00:00 app[web.1]:   Rendered layouts/_header.html.erb (3.3ms)
2015-12-19T02:24:41.841262+00:00 app[web.1]: Completed 200 OK in 10ms (Views: 6.8ms | ActiveRecord: 2.1ms)
2015-12-19T02:24:41.831334+00:00 app[web.1]: Processing by ListingsController#new as HTML
2015-12-19T02:24:41.840943+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.1ms)
2015-12-19T02:24:51.645313+00:00 app[web.1]: Started POST "/listings" for 98.111.222.34 at 2015-12-19 02:24:51 +0000
2015-12-19T02:24:51.702800+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/be92df52d8c615a3544b34c5583238aa20151219-3-111t5kc. JPG[0]' 2>/dev/null
2015-12-19T02:24:51.648437+00:00 app[web.1]: Processing by ListingsController#create as HTML
2015-12-19T02:24:51.648559+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"ydnYz/AwvfPd/Pgq7giMJdNN7jvz99EJr6o23GToNrE=", "listing"=>{"name"=>"test", "description"=>"test4", "price"=>"23", "image"=>#<ActionDispatch::Http::UploadedFile:0x007fba381cd3e8 @tempfile=#<Tempfile:/tmp/RackMultipart20151219-3-8615xw>, @original_filename="G0041454.JPG", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"listing[image]\"; filename=\"G0041454.JPG\"\r\nContent-Type: image/jpeg\r\n">}, "commit"=>"Create Listing"}
2015-12-19T02:24:51.671933+00:00 app[web.1]: Command :: file -b --mime '/tmp/be92df52d8c615a3544b34c5583238aa20151219-3-wjopfg. JPG'
2015-12-19T02:24:52.350285+00:00 app[web.1]: Command :: identify -format %m '/tmp/be92df52d8c615a3544b34c5583238aa20151219-3-111t5kc. JPG[0]'
2015-12-19T02:24:52.377523+00:00 app[web.1]: Command :: convert '/tmp/be92df52d8c615a3544b34c5583238aa20151219-3-111t5kc. JPG[0]' -auto-orient -resize "200" '/tmp/6d5387f824e51e59452f67a04053f06b20151219-3-od32ue'
2015-12-19T02:24:54.034905+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/be92df52d8c615a3544b34c5583238aa20151219-3-111t5kc. JPG[0]' 2>/dev/null
2015-12-19T02:24:54.691132+00:00 app[web.1]: Command :: identify -format %m '/tmp/be92df52d8c615a3544b34c5583238aa20151219-3-111t5kc. JPG[0]'
2015-12-19T02:24:54.713898+00:00 app[web.1]: Command :: convert '/tmp/be92df52d8c615a3544b34c5583238aa20151219-3-111t5kc. JPG[0]' -auto-orient -resize "100x100>" '/tmp/6d5387f824e51e59452f67a04053f06b20151219-3-5hjjqo'
2015-12-19T02:24:56.494356+00:00 heroku[router]: at=info method=POST path="/listings" host=yahozzle.herokuapp.com request_id=d47f234e-767e-4933-9c4f-ba7746046b94 fwd="98.111.222.34" dyno=web.1 connect=1ms service=6416ms status=500 bytes=1754
2015-12-19T02:24:56.475445+00:00 app[web.1]: Completed 500 Internal Server Error in 4827ms
2015-12-19T02:24:56.481503+00:00 app[web.1]:
2015-12-19T02:24:56.481507+00:00 app[web.1]: NoMethodError (undefined method `user_id=' for #<Listing:0x007fba387df1c8>):
2015-12-19T02:24:56.481508+00:00 app[web.1]:   app/controllers/listings_controller.rb:28:in `create'
2015-12-19T02:24:56.481509+00:00 app[web.1]:
2015-12-19T02:24:56.481510+00:00 app[web.1]:
2015-12-19T02:24:56.887992+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=yahozzle.herokuapp.com request_id=a6c9bc76-aece-4e86-8bd4-b7606561c6d6 fwd="98.111.222.34" dyno=web.1 connect=1ms service=6ms status=304 bytes=133
2015-12-19T02:27:07.434229+00:00 heroku[router]: at=info method=GET path="/" host=yahozzle.herokuapp.com request_id=123bbd6c-26e1-4a6d-883d-1370ff6901fe fwd="98.111.222.34" dyno=web.1 connect=2ms service=25ms status=200 bytes=2725
2015-12-19T02:27:07.379336+00:00 app[web.1]: Started GET "/" for 98.111.222.34 at 2015-12-19 02:27:07 +0000
2015-12-19T02:27:07.385916+00:00 app[web.1]:   Rendered listings/index.html.erb within layouts/application (2.5ms)
2015-12-19T02:27:07.389763+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.0ms)
2015-12-19T02:27:07.390032+00:00 app[web.1]: Completed 200 OK in 8ms (Views: 3.3ms | ActiveRecord: 3.6ms)
2015-12-19T02:27:07.382178+00:00 app[web.1]: Processing by ListingsController#index as HTML
2015-12-19T02:27:07.389539+00:00 app[web.1]:   Rendered layouts/_header.html.erb (2.9ms)
2015-12-19T02:27:07.776047+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=yahozzle.herokuapp.com request_id=e34057cb-957e-495b-a830-359ea9d7c3b9 fwd="98.111.222.34" dyno=web.1 connect=1ms service=4ms status=304 bytes=133
2015-12-19T02:27:11.095731+00:00 heroku[router]: at=info method=GET path="/listings/new" host=yahozzle.herokuapp.com request_id=9e55a522-c054-4d0f-ac12-84d7b3d6c239 fwd="98.111.222.34" dyno=web.1 connect=1ms service=17ms status=304 bytes=843
2015-12-19T02:27:11.056151+00:00 app[web.1]:   Rendered listings/_form.html.erb (3.4ms)
2015-12-19T02:27:11.048533+00:00 app[web.1]: Started GET "/listings/new" for 98.111.222.34 at 2015-12-19 02:27:11 +0000
2015-12-19T02:27:11.060342+00:00 app[web.1]:   Rendered layouts/_header.html.erb (3.2ms)
2015-12-19T02:27:11.056358+00:00 app[web.1]:   Rendered listings/new.html.erb within layouts/application (3.9ms)
2015-12-19T02:27:11.051415+00:00 app[web.1]: Processing by ListingsController#new as HTML
2015-12-19T02:27:11.060615+00:00 app[web.1]:   Rendered layouts/_footer.html.erb (0.0ms)
2015-12-19T02:27:11.060834+00:00 app[web.1]: Completed 200 OK in 9ms (Views: 6.6ms | ActiveRecord: 2.0ms)
2015-12-19T02:27:27.563172+00:00 app[web.1]: Started POST "/listings" for 98.111.222.34 at 2015-12-19 02:27:27 +0000
2015-12-19T02:27:27.604792+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/269cacd18ab98f8778799e31d4c88ecd20151219-3-1g8lsnh.jpg[0]' 2>/dev/null
2015-12-19T02:27:27.565996+00:00 app[web.1]: Processing by ListingsController#create as HTML
2015-12-19T02:27:27.566058+00:00 app[web.1]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"ydnYz/AwvfPd/Pgq7giMJdNN7jvz99EJr6o23GToNrE=", "listing"=>{"name"=>"pop", "description"=>"im", "price"=>"90", "image"=>#<ActionDispatch::Http::UploadedFile:0x007fba38256530 @tempfile=#<Tempfile:/tmp/RackMultipart20151219-3-1adj5z2>, @original_filename="British Guiana.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"listing[image]\"; filename=\"British Guiana.jpg\"\r\nContent-Type: image/jpeg\r\n">}, "commit"=>"Create Listing"}
2015-12-19T02:27:27.595948+00:00 app[web.1]: Command :: file -b --mime '/tmp/1cac73ca60d2fdd6f08b2eb575901fd720151219-3-13dfphx.jpg'
2015-12-19T02:27:28.145920+00:00 app[web.1]: Command :: identify -format %m '/tmp/269cacd18ab98f8778799e31d4c88ecd20151219-3-1g8lsnh.jpg[0]'
2015-12-19T02:27:28.156567+00:00 app[web.1]: Command :: convert '/tmp/269cacd18ab98f8778799e31d4c88ecd20151219-3-1g8lsnh.jpg[0]' -auto-orient -resize "200" '/tmp/97c51f07de38d7cd4b659d529a34fe7020151219-3-1xecq8b'
2015-12-19T02:27:28.941069+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/269cacd18ab98f8778799e31d4c88ecd20151219-3-1g8lsnh.jpg[0]' 2>/dev/null
2015-12-19T02:27:29.181772+00:00 app[web.1]: Command :: convert '/tmp/269cacd18ab98f8778799e31d4c88ecd20151219-3-1g8lsnh.jpg[0]' -auto-orient -resize "100x100>" '/tmp/97c51f07de38d7cd4b659d529a34fe7020151219-3-1kivmac'
2015-12-19T02:27:29.171358+00:00 app[web.1]: Command :: identify -format %m '/tmp/269cacd18ab98f8778799e31d4c88ecd20151219-3-1g8lsnh.jpg[0]'
2015-12-19T02:27:30.055505+00:00 heroku[router]: at=info method=POST path="/listings" host=yahozzle.herokuapp.com request_id=52b1ee8a-7f42-40ec-849a-880e7396d5a4 fwd="98.111.222.34" dyno=web.1 connect=1ms service=5290ms status=500 bytes=1754
2015-12-19T02:27:30.019622+00:00 app[web.1]: Completed 500 Internal Server Error in 2453ms
2015-12-19T02:27:30.021170+00:00 app[web.1]:
2015-12-19T02:27:30.021173+00:00 app[web.1]: NoMethodError (undefined method `user_id=' for #<Listing:0x007fba388448e8>):
2015-12-19T02:27:30.021174+00:00 app[web.1]:   app/controllers/listings_controller.rb:28:in `create'
2015-12-19T02:27:30.021175+00:00 app[web.1]:
2015-12-19T02:27:30.021176+00:00 app[web.1]:
2015-12-19T02:28:50.844318+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by art.westiv@gmail.com
2015-12-19T02:28:54.983823+00:00 heroku[run.9299]: Awaiting client
2015-12-19T02:28:55.030261+00:00 heroku[run.9299]: Starting process with command `bundle exec rake db:migrate`
2015-12-19T02:29:01.836526+00:00 heroku[run.9299]: Process exited with status 0
2015-12-19T02:28:55.396609+00:00 heroku[run.9299]: State changed from starting to up

A:

The cause of this error is that I have existing listings that haven’t been associated with a user.  So when Rails tried to display the user’s name on the homepage, it’s unable to do so.  To fix this, I’ll temporarily remove this Sold by #{listing.user.name}
Then I re-pushed my code to Heroku.  I deleted all of my listings.  I then created a new user and was able to successful post without a problem. 