Search code examples
ruby-on-railsactiverecordpassenger

Passenger on nginx is not reloading my changes ruby on rails


I have this query in one of my models (round.rb) and whenever a round is created I want to generate all matches that belong to that round automatically.

Match.create(
  home_player_user_id: home, 
  away_player_user_id: away, 
  round_id: id, 
  first_pokemon: 2, 
  second_pokemon: 2, 
  third_pokemon: 3)

I expect to see something like:

Match Create (0.8ms) INSERT INTO "matches" ("home_player_user_id", "away_player_user_id", "round_id", "created_at", "updated_at", "first_pokemon", "second_pokemon", "third_pokemon") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["home_player_user_id", 1], ["away_player_user_id", 1], ["round_id", 1], ["created_at", "2018-11-25 10:08:14.422748"], ["updated_at", "2018-11-25 10:08:14.422748"], ["first_pokemon", 2], ["second_pokemon", 2], ["third_pokemon", 3]]

in the logs.

However, I see only parts of that INSERT query being used like:

D, [2018-11-25T09:45:03.240848 #4994] DEBUG -- : Match Create (0.3ms) INSERT INTO "matches" ("away_player_user_id", "round_id", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["away_player_user_id", 1], ["round_id", 20], ["created_at", "2018-11-25 08:45:03.239943"], ["updated_at", "2018-11-25 08:45:03.239943"]]

in this example home_player_user_id was nil which is completely fine, however I don't see any other fields like first_pokemon, second_pokemon and so on being set in the database, which breaks my whole logic.

This only occurs on production on an nginx server (https) using passenger. I am restarting the passenger app with every deploy and thus I should have all the latest changes at hand. On my local machine it works completely fine in (with rails s) in production and development

Does someone have a clue on what I could be missing here?

Thank you very much in advance!


Solution

  • The problem was indeed that passenger and nginx were not reflecting the changes. I restarted the server machine completely and then it picked up the changes