I have a Rails 5 app that contains a lot of basic scaffold-like code. A bunch of models with associated controllers and views for basic CRUD operations. It runs under passenger and with nginx as a front end.
I have this app running on a production server, where everything is fine. But I also have it on a testing server, where one model (let's call it "Foo")'s new function fails. If I try to create a new model object, when I hit save (submit the form), I was getting a 404 from nginx. The URL shown in the location bar is what is expected (https://host.domain/foos). I have since fixed that nginx error, and now I get We're sorry, but something went wrong from Rails (or is it Passenger?)
The thing about Foo is that it contains 3 file uploads. Same thing is happening in another part of the app that tries to take a file upload from the user (all using the file_field
method on the form in the view). I feel sure this is the critical factor.
But when I check the Passenger log file, and Rails log file, there's nothing there. I also checked the output of journalctl -u passenger
(this is RHEL7), and nothing. How can I find where an error message is reported? Recall that everything works on my prod server that has almost identical configuration. Thanks.
Without any real code to look at, I'm just guessing.
A few ideas:
You say "test" server, but then other things you say make it sound like it persists, not just spins up for running a test suite, then shuts off. In the test environment, Rails truncates and runs database writes within a transaction it can roll back. So records don't exist to be found again, as one might expect to happen after submitting a new record form. Redirecting to an index or show view will fail to find that record.
Try running that "test" server as a "staging" environment so Rails actually persists data to the database.
Ensure you have the database actually created on this test server (e.g. your
database.yml
file)