views:

57

answers:

2

I just tried to deploy to Heroku and got a 500 server error.

heroku logs:

Started GET "/" for ##.##.###.### at 2010-10-14 17:59:34 -0700  
  Processing by WelcomeController#index as HTML
Rendered welcome/index.html.erb within layouts/index (2.3ms)
Completed   in 3ms

ActionView::Template::Error (can't convert nil into String):
5:   <meta charset="utf-8">
6:   <title>Hello</title>
7:   <%= stylesheet_link_tag "global", "home", :cache => true %>  
app/controllers/welcome_controller.rb:5:in `index'

I then tried to start my local server in production mode:

c:\Sanj\ruby>rails server production  
Exiting  
C:/Sanj/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/handler.rb:21:in `const_get': wrong constant name production (NameError)  
from C:/Sanj/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/handler.rb:21:in `get'
from C:/Sanj/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:217:in `server'
from C:/Sanj/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands/server.rb:54:in `start'
from C:/Sanj/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:30:in `block in <top (required)>'
from C:/Sanj/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:27:in `tap'
from C:/Sanj/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

These issues seem highly related - do you know what the issue might be here?

Thanks very much!


Welcome Controller#index

def index 
  render :layout => "index"
end

Please tell me if I can supply any more information.


Solution

Thanks to you guys for your answers. The problem was occurring because serve_static_assets was set to false in environments/production.rb. This enabled the system to find the CSS files that were apparently causing the 'nil'. The other change I tried was removing :cache => true from the stylesheets.

+1  A: 

They're not related. The error locally is because you're using the command incorrectly. Do:

rails server -e production
tfe
Thanks tfe. The most important error to me is the Heroku one because it is compromising the entire app from running. Do you know what the issue is there?
sscirrus
Sorry, can't say. Can you post the content of your layout and index view? Can you not render any other views, or is it just this one failing?
tfe
+1  A: 

Well, I don't know if these 2 issues related...

First, would you please provide the code of your welcome controller? let's see what's going on there.

Second, your command not correct, please run: rails server -e production

Daniel Chen
Hi Daniel, I've added in the welcome controller index action.
sscirrus
Hello @sscirrus, sorry but from current information, I can't tell what's wrong. But can you try to not render the index layout first, to isolate the problem. Or you can update the index layout view.
Daniel Chen