简体   繁体   中英

Rails problems between development and production

I'm dealing with some weird inconsistencies on my production server for my rails website/blog.

For instance, on my development server (just running Webrick) this is my navbar (which is correct) and shows up 100% of the time:

在此处输入图片说明

After pushing my latest code to the production server (passenger & nginx), my navbar now shows (notice the missing blog link) and shows up about 40% of the time. I have to keep hitting 'refresh' on my browser until the blog link to shows:

在此处输入图片说明

What gives here? New to RoR, but I believe the issue lies with my Blog MVC. I've been taking a look at the log files for nginx and they show nothing.

Where else can I go to diagnose this issue?


Here is the code in my navbar partial (_navigation.html.erb)

<div class="navbar-collapse collapse">
  <ul class="nav navbar-nav">
    <li class="active"><a href="/">Home</a></li>
    <li><%= link_to("How It Works", "/howto") %></li>
    <li><%= link_to("FAQ", "/frequent") %></li>
    <li><%= link_to("Blog", blogs_path) %></li>
    <li><%= link_to("Contact Us", "/contact_forms/new") %></li>
  </ul>
</div>

Tailing production.log isn't very revealing either. When the 'Blog' link does load:

I, [2015-03-31T12:48:59.624208 #5061]  INFO -- : Started GET "/" for X.X.X.X at 2015-03-31 12:48:59 -0400
I, [2015-03-31T12:48:59.625722 #5061]  INFO -- : Processing by StaticPagesController#home as HTML
D, [2015-03-31T12:48:59.627223 #5061] DEBUG -- :   Testimonial Load (0.4ms)  SELECT "testimonials".* FROM "testimonials"
I, [2015-03-31T12:48:59.628629 #5061]  INFO -- :   Rendered layouts/_navigation.html.erb (0.3ms)
I, [2015-03-31T12:48:59.631063 #5061]  INFO -- :   Rendered layouts/_footer.html.erb (0.5ms)
I, [2015-03-31T12:48:59.631303 #5061]  INFO -- :   Rendered static_pages/home.html.erb within layouts/application (3.1ms)
I, [2015-03-31T12:48:59.632149 #5061]  INFO -- : Completed 200 OK in 6ms (Views: 4.3ms | ActiveRecord: 0.4ms)

When the Blog link doesn't load production.log hardly has anything written to it. It's like the server is only registering a partial load of the page or something.

I've made my changes, rebooted the web server (both nginx & passenger), and even rebooted the actual server itself... still no luck.

I'm at a loss on what to do to fix this issue since everything works perfectly fine in development and I'm still pretty new to RoR.

The source code is pretty trivial and there is no conditional branching ( if ) around the blog link.

Therefore, the only explanation is that the code running in production is not the one you have in development.

Make sure your deploy was successful. Inspect your server folder to make sure the code is in there. Also make sure the webserver was restarted, otherwise it may still be serving the previously deployed code. For Passenger and Nginx you need (unless it changed) to touch the restart.txt file inside the /tmp/restart.txt project folder in order to perform a Passenger restart (without obviously restarting the entire Nginx process).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM