I recently upgraded my app to the asset pipeline while on Rails 3.2.11, and in the process decided to use the Heroku Rails Deflate gem to help with gzip compression and cache control headers on the Cedar stack. There were dependency issues so I had to upgrade to Rails 3.2.14.
After the upgrade, I could not run my tests or even start my Rails server. There error I get is:
missing :action (ArgumentError)
/Users/mackshkatz/.rvm/gems/ruby-1.9.2-p290#xxxxxx/gems/actionpack-3.2.14/lib/action_dispatch/routing/mapper.rb:178:in `default_controller_and_action'
The issue is fixed when I comment out line 3 in my routes.rb file:
Blogmutt::Application.routes.draw do
root :to => 'pages#home'
put 'reports/save_customer_tracking/'
I have no idea why this is suddenly breaking. I can start up the server with it commented out, but of course the form in my app that uses the named route generated from that line is now broken.
Why is this line suddenly broken?
Related
I've followed the instructions for the Railscast on upgrading a Rails app to 3.1:
http://railscasts.com/episodes/282-upgrading-to-rails-3-1?view=asciicast
The server doesn't recognize requests for any folders within app/assets.
Just to be sure, I've run rake rails:update and diff'd the files against what we have. It looks like every old config flag has been removed and every new config flag has been set.
When I load the homepage, I see the following in the javascript console:
"NetworkError: 404 Not Found - http://localhost:3000/assets/application.js"
"NetworkError: 404 Not Found - http://localhost:3000/assets/application.css"
Does anyone have any suggestions? I'm completely stumped, short of creating a new app and moving things over.
The issue was with the active_reload gem in our project. Disabling it in the gemfile and running bundle install fixed the issue
Apparently the first statement on the project page is that it's incompatible with Rails 3.2.x.
I've tried those 3 hosting approaches for my Rails app, and no matter what I do, I can't get consistant logging when I run in the production environment.
For my tests, I created a blank app and tried to access the root directory. I would then add a users scaffold and rake the database.
If I turn RAILS_ENV to development, the log/devlopment.log works just fine, logging everything that I would expect.
When I turn RAILS_ENV to production, the log/production.log logs in a strange manner. In Passenger, I get the first routing error. Then nothing. When I restarted apache or nginx, I would get all the routing errors that I had caused since the first (logged) one, then the log would fail to write anything new until I restarted the underlying server. apache2/error.log would get logged to if I had a configuration issue. Then it only logged cache misses
With Thin and Unicorn, I only get errors about the static assets (I did not precompile the assets). Once I precompiled the assets, no more log messages appeared.
On all 3 setups, I would get precompilation messages (when I ran assets:precompile) in production.log (indicating that Rails could at least write to the log).
Does anyone have a Rails 3.2.1 app that is running on one of the deployment gems (Passenger, Thin, or Unicorn), that is logging correctly in production mode? I've spent 5 days working on this. I'm out of ideas.
Turns out its a reported issue in Rails 3.2.x. A fix has been submitted and will hopefully be released with Rails 3.2.2.
https://github.com/rails/rails/issues/4277
I've get an action in my Rails 3 app that I'm pw-protecting with authenticate_or_request_with_http_basic. Working fine on my development machine but it's not prompting for the http_basic user/password on the production server.
The entire production app runs over https/SSL on nginx.
Where do I look to resolve this? Does http basic auth not work over SSL? Or is there an nginx setting I need to look at?
TIA
Not sure if this related to Rails 3.
I just recently had problems running Mongrel 1.1.5 and Rails 2.3.8
Apparently, there is a bug in this set up where our production machine does not prompt for the user name and password (but works locally, because we are using web-brick).
In the mongrel.log we keep getting this error:
Error calling Dispatcher.dispatch #split' called for nil
:NilClass>
/usr/local/rvm/gems/ruby-1.8.7-p174/gems/actionpack-2.3.8/lib/action_controller/cgi_process.rb:52:indispatch_cgi'
/usr/local/rvm/gems/ruby-1.8.7-p174/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
...
Found the monkey patch needed to fix this Mongrel 1.1.5 and Rails 2.3.8 and it worked for me.
The german site that lead to the solution: http://railssprech.de/ with 2 links for 2.3.8 and 2.3.9.
Here is the 2.3.8 version: http://www.pcoder.net/error-calling-dispatcher-dispatch/#axzz1RknBQso2
The patch explains why this error was occurring. Check the Rails 3 CGIHandler.dispatch_cgi method and see if it the same bug. You may need to extract the Rails 3 out and monkey patch it.
Hope this helps.
BTW: Mongrel 1.1.5 and Rails 2.3.5 works!
I'm following the Getting Started with Rails guide but ran into an issue opening http://localhost:3000
Shell output:
[2010-03-23 19:19:14] ERROR NameError: uninitialized constant ActiveResource::Base
Error in the browser:
Internal Server Error
uninitialized constant ActiveResource::Base
WEBrick/1.3.1 (Ruby/1.8.7/2009-06-12) at localhost:3000
I followed the directions exactly as they were specified in the guide:
Ran rails generate controller home index
I removed index.html
Added root :to => "home#index" to config/routes.rb
I checked app/views/home/index.html.erb and it is indeed there.
I then used rails server to launch the server. At first attempt the browser loads a blank page, but afterwards starts showing the browser error above.
Why is it that Rails can't locate the index.html.erb file? Or is the error something different?
-
Running Rails 3.0beta with Ruby 1.8.7
uninitialized
constant ActiveResource::Base
It looks like there's a problem with your Ruby/Rails setup.
Do you have more than one version of Ruby on your system? It could be that the version of Ruby you're using to run your app is looking for the Rails gems (ActiveResource::Base) in the wrong repository.
If you're using the Getting Started guide I recommend that you don't use Rails 3.0 beta, as, well, it's a beta release. It's best to use the stable-of-the-moment 2.3.5.
I have this error as well. I am running Ruby 1.8.7 p249 under RVM - Rails 3 beta3 on Ubuntu (Lucid Lynx). The strange thing is I have the exact same setup (RVM, Ruby version & gems) on my Mac and it works fine.
UPDATE: I tried again using RVM to switch to Ruby-1.9.2-HEAD and everything is working as expected. Still doesn't solve problem but it get Rails 3 working at least.
I'm getting Ruby on Rails set up on a fresh installation of Snow Leopard. After battling (and beating) MySQL and Sphinx problems, I'm stuck on a stupid error related to HAML.
Essentially I'm getting a missing template error for every view that uses HAML. I can add a blank xxx.html.erb file and and a (blank) page loads fine. But xxx.html.haml throws the error, even though that file definitely exists in the appropriate directory.
Here is the error from the development server:
ActionView::MissingTemplate (Missing template sections/index.erb in view path app/views):
haml (2.2.4) rails/./lib/sass/plugin/rails.rb:19:in `process'
I am using the haml gem (2.2.4), rails gem (2.3.4), and ruby 1.8.7. I did run haml --rails . from my RoR app root directory; the init file is in the vendor/plugins/haml directory. I have confirmed that "require 'haml'" => true via IRB.
Any help would be appreciated!
In response to Yaraher:
Tried un- and re-installing, which raised no errors except with the rdocs ("Could not find main page README.rdoc").
In script/console:
>> require 'haml'
=> []
Update:
Installing an old version of Rails known to work with HAML in this project seems to have "fixed" the problem. I'd still be curious to hear a real answer to this problem -- I don't want to be stuck at 2.3.2.
sudo gem install -v 2.3.2 rails
Update 2:
This is definitely caused by a difference between Rails 2.3.2 and 2.3.4. With both gems installed I can set which is used in my environment.rb file. HAML works fine with 2.3.2 and breaks as described with 2.3.4.
Time for the embarrassing answer to this question:
There is a difference between Rails 2.3.2 and 2.3.4 that does not recognize xxx.haml.html files as files that should be parsed by HAML (or ERB); this worked fine in 2.3.2. HAML files should always be named xxx.html.haml anwyay, so this isn't even a bug.
I didn't realize that this was the problem because I had the "hide file extensions" option turned on (on by default) in my fresh Snow Leopard installation. So when I tried switching the file extension through Finder to html.haml to test this, it actually changed it to haml.html.haml or some nonsense.
Moral of the story: I ran the following script and now HAML works with Rails 2.3.4.
path = '/path_to_rails_app/views/'
dir = Dir.new(path)
dir.each do |d|
if File.directory?(path+d)
Dir.new(path+d).each do |f|
if (f =~ /.*\.haml\.html$/) != nil
File.rename(path+d+'/'+f, path+d+'/'+f.gsub('haml.html', 'html.haml'))
end
end
end
end
Try to rename your template to
sections/_index.haml
or
sections/__index.haml