During development of Ruby on Rails applications I have the development log constantly tailing via tail -f log/development.log.
I have only started developing in Rails a few weeks ago, so I don't know if the log has always shown this many entries, but I believe assets have just recently been added in 3.1. Regardless, this is an exerpt of my development.log for a page call:
Started GET "/assets/reset.css?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011
Served asset /reset.css - 304 Not Modified (1ms)
Started GET "/assets/style.css?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011
Served asset /style.css - 304 Not Modified (0ms)
Started GET "/assets/application.css?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011
Started asset /application.css - 304 Not Modified (0ms)
Started GET "/assets/application.js?body=1" for 70.63.17.68 at Wed Oct 12 20:10:49 +0000 2011
Served asset /application.js - 200 OK (1ms)
There are actually a few more entried, but I think you got the picture of this taking up a lot of space with all the new lines in between each GET request. I also delete all the unused scss and coffee files that Rails creates when using generate.
I just want to see all database calls and actual page calls in my development.log when I tail it.
I was wondering if anyone knows of a way to stop Rails logging these events, or if there is a | grep way of excluding everything related to assets.
Help is much appretiated, thanks.
In your config/environments/development.rb set
config.assets.debug = false
Related
Rails (3.1.2) application with the twitter-bootstrap-rails (2.2.8) gem.
The application uses font awesome icons in views.
The application.css.scss contains
#import "bootstrap_and_overrides";
bootstrap_and_overrides.css.less
#import "twitter/bootstrap/bootstrap";
#import "twitter/bootstrap/responsive";
// Set the correct sprite paths
#iconSpritePath: image-url("twitter/bootstrap/glyphicons-halflings.png");
#iconWhiteSpritePath: image-url("twitter/bootstrap/glyphicons-halflings-white.png");
// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
#fontAwesomeEotPath: asset-url("fontawesome-webfont.eot");
#fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix");
#fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff");
#fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf");
#fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular");
// Font Awesome
#import "fontawesome/font-awesome";
On the local development environment everything is ok.
After deployment with Capistrano to a staging environment, the icons are not showing up in the browsers.
Instead in the server console and in the browsers network monitor an 404 error shows up for the necesarry fontawesome font files.
Started GET "/assets/fontawesome-webfont.woff"
Served asset /fontawesome-webfont.woff - 404 Not Found (2ms)
ActionController::RoutingError (No route matches [GET] "/assets/fontawesome-webfont.woff"):
cache: [GET /assets/fontawesome-webfont.ttf] miss
Started GET "/assets/fontawesome-webfont.ttf"
Served asset /fontawesome-webfont.ttf - 404 Not Found (2ms)
ActionController::RoutingError (No route matches [GET] "/assets/fontawesome-webfont.ttf"):
cache: [GET /assets/fontawesome-webfont.svg] miss
Started GET "/assets/fontawesome-webfont.svg"
Served asset /fontawesome-webfont.svg - 404 Not Found (4ms)
ActionController::RoutingError (No route matches [GET] "/assets/fontawesome-webfont.svg"):
Concerning the 404 errors, looking in the appropriate folder on the staging server
[root#j87849 assets]# ls -l
total 840
-rw-rw-r-- 1 deploy deploy 288667 21. Apr 20:01 application.css
-rw-rw-r-- 1 deploy deploy 32651 21. Apr 20:01 application.css.gz
-rw-rw-r-- 1 deploy deploy 295 21. Apr 20:01 application.js
-rw-rw-r-- 1 deploy deploy 197 21. Apr 20:01 application.js.gz
-rwxr-xr-x 1 deploy deploy 37405 5. Apr 20:18 fontawesome-webfont.eot
-rwxr-xr-x 1 deploy deploy 197829 5. Apr 20:18 fontawesome-webfont.svg
-rwxr-xr-x 1 deploy deploy 79076 5. Apr 20:18 fontawesome-webfont.ttf
-rwxr-xr-x 1 deploy deploy 43572 5. Apr 20:18 fontawesome-webfont.woff
Update to Rails 3.2 solved the issue
I'm not sure when this started, but something unusual is happening in my app (run locally on a development machine). Suddenly I am seeing messages like:
Started GET "/" for 127.0.0.1 at 2013-03-10 12:10:24 +1300
Processing by PagesController#home as HTML
Rendered pages/home.html.erb within layouts/application (2.4ms)
Completed 200 OK in 3242ms (Views: 3241.4ms | ActiveRecord: 0.0ms)
As you can see 3 seconds to load the home page (a relatively simple page) ... We're not talking a hard page reload .. just clicking on the "home" link again from another page.
Not really sure where to start here, but this is my application.rb:
#config/boot.rb is loaded
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
Bundler.require(*Rails.groups(:assets => %w(development test)))
end
module Goodsounds
class Application < Rails::Application
config.encoding = "utf-8"
config.filter_parameters += [:password]
config.assets.initialize_on_precompile = false
config.assets.enabled = true
config.action_controller.assets_dir = "#{File.dirname(File.dirname(__FILE__))}/public"
config.assets.version = '1.0'
config.autoload_paths += Dir["#{Rails.root}/lib/modules"]
config.assets.paths += Dir["#{Rails.root}/app/assets/fonts/*"]
config.assets.precompile += %w( .svg .eot .woff .ttf )
end
end
...and dev.rb:
Goodsounds::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
Paperclip.options[:command_path] = "/usr/bin/"
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.raise_delivery_errors = true
# set delivery method to :smtp, :sendmail or :test
config.action_mailer.delivery_method = :smtp
# these options are only needed if you choose smtp delivery
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Raise exception on mass assignment protection for Active Record models
config.active_re
cord.mass_assignment_sanitizer = :strict
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
end
EDIT:
OK, Here is what I am seeing on new relic. Doesn't really help me though. Any thoughts?
Oh and what I learned from Chrome timeline:
Send Request - Details
Duration 0 (at 655 ms)
Resource localhost
Request Method GET
Receive Response - Details
Duration 0.043 ms (at 4.17 s)
Resource localhost
Status Code 200
MIME Type text/html
Receive Data - Details
Duration 176.329 ms (at 4.17 s)
Self Time 7.037 ms
CPU Time 176.329 ms
Aggregated Time 061.194 ms114.664 ms0.471 ms0
Resource localhost
Encoded Data Length 303 Bytes
Used Heap Size 29.1 MB (+5.7 MB)
Finish Loading - Details
Duration 0 (at 4.35 s)
Resource localhost
By the way I disabled the quiet_assets gem to see what I could discover in the terminal.. again.. not helpful:
Started GET "/" for 127.0.0.1 at 2013-03-10 21:46:40 +1300
Processing by PagesController#home as HTML
Rendered pages/home.html.erb within layouts/application (43.4ms)
Completed 200 OK in 3501ms (Views: 3480.9ms | ActiveRecord: 19.4ms)
Started GET "/assets/dataTables/jquery.dataTables.bootstrap.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /dataTables/jquery.dataTables.bootstrap.css - 304 Not Modified (11ms)
Started GET "/assets/chosen.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /chosen.css - 304 Not Modified (5ms)
Started GET "/assets/select2.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /select2.css - 304 Not Modified (4ms)
Started GET "/assets/autocomplete.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /autocomplete.css - 304 Not Modified (1ms)
Started GET "/assets/branches.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /branches.css - 304 Not Modified (2ms)
Started GET "/assets/bubbles.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bubbles.css - 304 Not Modified (1ms)
Started GET "/assets/business_show.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /business_show.css - 304 Not Modified (1ms)
Started GET "/assets/chunkyfive_font.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /chunkyfive_font.css - 304 Not Modified (1ms)
Started GET "/assets/consumer_show.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /consumer_show.css - 304 Not Modified (2ms)
Started GET "/assets/datatable_styling.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /datatable_styling.css - 304 Not Modified (1ms)
Started GET "/assets/datepicker.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /datepicker.css - 304 Not Modified (2ms)
Started GET "/assets/devise_links.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /devise_links.css - 304 Not Modified (1ms)
Started GET "/assets/dispenser_show.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /dispenser_show.css - 304 Not Modified (1ms)
Started GET "/assets/fonts.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /fonts.css - 304 Not Modified (1ms)
Started GET "/assets/forms.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /forms.css - 304 Not Modified (2ms)
Started GET "/assets/gmaps4rails.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails.css - 304 Not Modified (1ms)
Started GET "/assets/jquery-ui-1.10.0.custom.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jquery-ui-1.10.0.custom.css - 304 Not Modified (2ms)
Started GET "/assets/jumbotrons.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jumbotrons.css - 304 Not Modified (1ms)
Started GET "/assets/layout.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /layout.css - 304 Not Modified (1ms)
Started GET "/assets/open_sans.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /open_sans.css - 304 Not Modified (2ms)
Started GET "/assets/popover.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /popover.css - 304 Not Modified (1ms)
Started GET "/assets/reviews.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /reviews.css - 304 Not Modified (1ms)
Started GET "/assets/spinner.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /spinner.css - 304 Not Modified (2ms)
Started GET "/assets/style_show.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /style_show.css - 304 Not Modified (2ms)
Started GET "/assets/style_show_reviews.css?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /style_show_reviews.css - 304 Not Modified (2ms)
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jquery.js - 304 Not Modified (3ms)
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jquery_ujs.js - 304 Not Modified (3ms)
Started GET "/assets/ui.custom.min.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /ui.custom.min.js - 304 Not Modified (1ms)
Started GET "/assets/bootstrap-transition.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-transition.js - 304 Not Modified (5ms)
Started GET "/assets/bootstrap-affix.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-affix.js - 304 Not Modified (3ms)
Started GET "/assets/bootstrap-alert.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-alert.js - 304 Not Modified (4ms)
Started GET "/assets/bootstrap-button.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-button.js - 304 Not Modified (5ms)
Started GET "/assets/bootstrap-carousel.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-carousel.js - 304 Not Modified (3ms)
Started GET "/assets/bootstrap-collapse.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-collapse.js - 304 Not Modified (3ms)
Started GET "/assets/bootstrap-dropdown.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-dropdown.js - 304 Not Modified (3ms)
Started GET "/assets/bootstrap-modal.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-modal.js - 304 Not Modified (3ms)
Started GET "/assets/bootstrap-scrollspy.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-scrollspy.js - 304 Not Modified (3ms)
Started GET "/assets/bootstrap-tab.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-tab.js - 304 Not Modified (3ms)
Started GET "/assets/bootstrap-tooltip.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-tooltip.js - 304 Not Modified (5ms)
Started GET "/assets/bootstrap-popover.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-popover.js - 304 Not Modified (52ms)
Started GET "/assets/bootstrap-typeahead.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap-typeahead.js - 304 Not Modified (3ms)
Started GET "/assets/bootstrap.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /bootstrap.js - 304 Not Modified (13ms)
Started GET "/assets/gmaps4rails/gmaps4rails.base.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails/gmaps4rails.base.js - 304 Not Modified (1ms)
Started GET "/assets/gmaps4rails/gmaps4rails.bing.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails/gmaps4rails.bing.js - 304 Not Modified (2ms)
Started GET "/assets/gmaps4rails/gmaps4rails.googlemaps.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails/gmaps4rails.googlemaps.js - 304 Not Modified (2ms)
Started GET "/assets/gmaps4rails/gmaps4rails.mapquest.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails/gmaps4rails.mapquest.js - 304 Not Modified (2ms)
Started GET "/assets/gmaps4rails/gmaps4rails.openlayers.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /gmaps4rails/gmaps4rails.openlayers.js - 304 Not Modified (2ms)
Started GET "/assets/jqueryplugins/addresspicker.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/addresspicker.js - 304 Not Modified (2ms)
Started GET "/assets/jqueryplugins/browser_detect.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/browser_detect.js - 304 Not Modified (3ms)
Started GET "/assets/jqueryplugins/charts.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/charts.js - 304 Not Modified (2ms)
Started GET "/assets/jqueryplugins/jquery.alphanumeric.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/jquery.alphanumeric.js - 304 Not Modified (1ms)
Started GET "/assets/jqueryplugins/jquery.formrestrict.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/jquery.formrestrict.js - 304 Not Modified (2ms)
Started GET "/assets/jqueryplugins/jquery.lazyload.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/jquery.lazyload.js - 304 Not Modified (1ms)
Started GET "/assets/jqueryplugins/raty.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /jqueryplugins/raty.js - 304 Not Modified (2ms)
Started GET "/assets/dataTables/jquery.dataTables.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /dataTables/jquery.dataTables.js - 304 Not Modified (13ms)
Started GET "/assets/dataTables/jquery.dataTables.bootstrap.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /dataTables/jquery.dataTables.bootstrap.js - 304 Not Modified (63ms)
Started GET "/assets/lib/abstract-chosen.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /lib/abstract-chosen.js - 304 Not Modified (12ms)
Started GET "/assets/lib/select-parser.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /lib/select-parser.js - 304 Not Modified (12ms)
Started GET "/assets/chosen.jquery.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /chosen.jquery.js - 304 Not Modified (8ms)
Started GET "/assets/chosen-jquery.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /chosen-jquery.js - 304 Not Modified (9ms)
Started GET "/assets/select2.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /select2.js - 304 Not Modified (7ms)
Started GET "/assets/highcharts.js?body=1" for 127.0.0.1 at 2013-03-10 21:46:44 +1300
Served asset /highcharts.js - 304 Not Modified (1ms)
By the way, as per a suggestion on reddit I precompiled assets and ran the server. Seeing fantastic speeds:
Processing by PagesController#home as HTML
Rendered pages/home.html.erb within layouts/application (1.1ms)
Completed 200 OK in 6ms (Views: 5.4ms | ActiveRecord: 0.0ms)
Ok not sure this is providing any help or not but the major delay is happening between these two lines of code in the stack:
From: /home/funkdified/.rvm/gems/ruby-1.9.3-p392#goodsounds/gems/actionpack-3.2.13.rc1/lib/action_controller/metal/implicit_render.rb # line 5 ActionController::ImplicitRender#send_action:
3: def send_action(method, *args)
4: ret = super
=> 5: default_render unless response_body
6: ret
7: end
[2] pry(#<PagesController>)> next
MAJOR DELAY
From: /home/funkdified/.rvm/gems/ruby-1.9.3-p392#goodsounds/gems/actionpack-3.2.13.rc1/lib/action_controller/metal/implicit_render.rb # line 6 ActionController::ImplicitRender#send_action:
3: def send_action(method, *args)
4: ret = super
5: default_render unless response_body
=> 6: ret
7: end
Ok, I figured it out (at long last). Without changing any of my actual assets I am now seeing this is development:
Started GET "/" for 127.0.0.1 at 2013-03-11 23:14:33 +1300
Processing by PagesController#home as HTML
Rendered pages/home.html.erb within layouts/application (1.3ms)
It turns out the delay was being caused by config.assets.debug = true inside of development.rb. Setting this to false resolves the problem.
Looks like the Rails core team debated turning this off by default, but decided against the idea. In the future I'd love to see them put something in the comment section of development.rb to tip off users of the potential for significant delays.
May I suggest the following:
# Expands the lines which load the assets
# May cause significant delays in view rendering
Great, they heard me muttering and updated rails!
The same issue has appeared for me in rails 4.1+. Abram's answer is only partially complete.
You can leave config.assets.debug = true but should disable new assets verification feature
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = false
Solution with config.assets.debug disabled only works because it compiles assets once and assets are verified once. Assets verification is where the most of the time is spent.
If you're coming from rails 3.2.13 note that a bunch of people have experienced this issue and reverting to 3.2.12 seems to resolve it. You can find more info here on github.
In my case disabling config.assets.debug sped things up a little, but reverting to 3.2.12 dropped request time from around 4 seconds to around 250ms.
Take a look at NewRelic.com - it costs, but the free trial will allow you to totally dissect your application and work out where any bottlenecks are.
Aside from New Relic run through the usual checks, e.g. when did it start? What have you changed recently? Have you upgraded Rails and/or any gems? Check out and run a few previous versions from your source control and try and work out specifically which commit caused the issue.
Does the issue happen with all browsers? Try firing up the Chrome timeline viewer and you'll be able to see if the browser is getting stuck up on a particular piece of JavaScript.
Also try switching your local dev web server to thin, does the issue persist?
Good luck!
Are you on OSX and serving via .local?
If so, gonna throw the post I found in my comments as a solution:
Subdomain constraint (Rails 3) makes local server (thin) SO SLOW
i am using rails 3.0.3 and i recently installed ckeditor to add text editor in my articles.before adding this editor everything was working fine.but after installing ckeditor(followed this : https://github.com/hificreative/rails-3-ckeditor) i am getting text editor in my articles page but i am getting routes error in console and i am not able to save data on clicking save button...
console output :
Started GET "/javascripts/reset.js" for 127.0.0.1 at Fri Mar 23 13:28:19 +0530 2012
ActionController::RoutingError (No route matches "/javascripts/reset.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.5ms)
Started GET "/javascripts/grid.js" for 127.0.0.1 at Fri Mar 23 13:28:19 +0530 2012
ActionController::RoutingError (No route matches "/javascripts/grid.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.8ms)
Started GET "/javascripts/style.js" for 127.0.0.1 at Fri Mar 23 13:28:19 +0530 2012
ActionController::RoutingError (No route matches "/javascripts/style.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (2.2ms)
ActionController::RoutingError (No route matches "/javascripts/style.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (2.2ms)
Started GET "/javascripts/messages.js" for 127.0.0.1 at Fri Mar 23 13:28:19 +0530 2012
ActionController::RoutingError (No route matches "/javascripts/messages.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.8ms)
Started GET "/javascripts/forms.js" for 127.0.0.1 at Fri Mar 23 13:28:19 +0530 2012
ActionController::RoutingError (No route matches "/javascripts/forms.js"):
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.4ms)
i have included following in my gemfile :
gem 'ckeditor', '3.5.0'
following are the steps that i followed to install ckeditor:
Next step is generate ckeditor js files and configuration file Check “config/initializers/ckeditor.rb” for more configuration options:
rails generate ckeditor:base
Generate ckeditor models for file upload support: For paperclip:
rails generate ckeditor:migration
For attachment_fu:
rails generate ckeditor:migration --backend=attachment_fu
Don’t forget about migration:
rake db:migarte
included following line in my lauout.application.html.haml file
= javascript_include_tag :ckeditor
and wrote following line in my articles _form.html.haml file
form.cktext_area :content
how to solve this error.....
Not sure I can help with that particular gem but I just installed using this one with instant success.
https://github.com/galetahub/ckeditor
Ok, I just restarted my PC and then everything started working normally, without this error.
I use ruby-openid to allow auth with openid
when i use ruby 1.8 with rails as below:
ii rails 2.3.5-1.2+squeeze1 MVC ruby based framework geared for web application development
ii rails-ruby1.8 2.3.5-1.2+squeeze1 MVC ruby based framework geared for web application development
ii rake 0.8.7-2 a ruby build program
ii ruby 4.5 An interpreter of object-oriented scripting language Ruby
ii ruby1.8 1.8.7.302-2squeeze1 Interpreter of object-oriented scripting language Ruby 1.8
ii ruby1.8-dev 1.8.7.302-2squeeze1 Header files for compiling extension modules for the Ruby 1.8
ii rubygems 1.3.7-3 package management framework for Ruby libraries/applications
ii rubygems1.8 1.3.7-3 package management framework for Ruby libraries/applications
everything work fine.
but when i update to:
ruby 1.9.3p125 (2012-02-16) [x86_64-linux]
Rails 3.2.2
1.8.11
after auth succ from the the OpenID Provider and return to my page, exception raised:
Verification failed: Unexpected parameter (not on return_to): 'controller'=nil)
i try to read idres.rb and found:
#message.get_args(BARE_NS).each_pair do |bare_key, bare_val|
rt_val = return_to_parsed_query[bare_key]
if not return_to_parsed_query.has_key? bare_key
# This may be caused by your web framework throwing extra
# entries in to your parameters hash that were not GET or
# POST parameters. For example, Rails has been known to
# add "controller" and "action" keys; another server adds
# at least a "format" key.
raise ProtocolError, ("Unexpected parameter (not on return_to): "\
"'#{bare_key}'=#{rt_val.inspect})")
end
if rt_val != bare_val
raise ProtocolError, ("Parameter '#{bare_key}' value "\
"#{bare_val.inspect} does not match "\
"return_to's value #{rt_val.inspect}")
i am a newbie to ruby. how to solve this ? thanks very much
log below:
Started GET "/consumer/start" for 218.107.55.254 at 2012-03-06 18:12:26 +0800 Processing by ConsumerController#start as HTML Redirected to http://pip.verisignlabs.com/server?openid.assoc_handle=e25c42b0-6774-11e1-9fdb-8f540be9bc3e&openid.claimed_id=http%3A%2F%2Fstutiredboy.pip.verisignlabs.com%2F&openid.identity=http%3A%2F%2Fstutiredboy.pip.verisignlabs.com%2F&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.sreg=http%3A%2F%2Fopenid.net%2Fextensions%2Fsreg%2F1.1&openid.realm=http%3A%2F%2F114.113.197.25%3A3000%2Fconsumer&openid.return_to=http%3A%2F%2F114.113.197.25%3A3000%2Fconsumer%2Fcomplete%3Fdid_sreg%3Dy&openid.sreg.required=email%2Cnickname%2Cfullname Completed 302 Found in 4914ms (ActiveRecord: 0.0ms)
Started GET "/consumer/complete?did_sreg=y&openid.sreg.fullname=tiredboy&openid.assoc_handle=e25c42b0-6774-11e1-9fdb-8f540be9bc3e&openid.response_nonce=2012-03-06T10%3A12%3A32ZzI16RQ%3D%3D&openid.sreg.email=stumyreg%40gmail.com&openid.sreg.nickname=tiredboy&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=http%3A%2F%2Fpip.verisignlabs.com%2Fserver&openid.pape.auth_policies=http%3A%2F%2Fschemas.openid.net%2Fpape%2Fpolicies%2F2007%2F06%2Fnone&openid.claimed_id=http%3A%2F%2Fstutiredboy.pip.verisignlabs.com%2F&openid.sig=yNsdpak%2FyNi%2BcFp0oxmjtL3DmoY%3D&openid.identity=http%3A%2F%2Fstutiredboy.pip.verisignlabs.com%2F&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.auth_time=2012-03-06T07%3A16%3A09Z&openid.signed=assoc_handle%2Cidentity%2Cresponse_nonce%2Creturn_to%2Cclaimed_id%2Cop_endpoint%2Cns.sreg%2Csreg.nickname%2Csreg.email%2Csreg.fullname%2Cns.pape%2Cpape.auth_policies%2Cpape.auth_time&openid.ns.sreg=http%3A%2F%2Fopenid.net%2Fextensions%2Fsreg%2F1.1&openid.return_to=http%3A%2F%2F114.113.197.25%3A3000%2Fconsumer%2Fcomplete%3Fdid_sreg%3Dy" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Processing by ConsumerController#complete as HTML Parameters: {"did_sreg"=>"y", "openid.sreg.fullname"=>"tiredboy", "openid.assoc_handle"=>"e25c42b0-6774-11e1-9fdb-8f540be9bc3e", "openid.response_nonce"=>"2012-03-06T10:12:32ZzI16RQ==", "openid.sreg.email"=>"stumyreg#gmail.com", "openid.sreg.nickname"=>"tiredboy", "openid.ns"=>"http://specs.openid.net/auth/2.0", "openid.mode"=>"id_res", "openid.op_endpoint"=>"http://pip.verisignlabs.com/server", "openid.pape.auth_policies"=>"http://schemas.openid.net/pape/policies/2007/06/none", "openid.claimed_id"=>"http://stutiredboy.pip.verisignlabs.com/", "openid.sig"=>"yNsdpak/yNi+cFp0oxmjtL3DmoY=", "openid.identity"=>"http://stutiredboy.pip.verisignlabs.com/", "openid.ns.pape"=>"http://specs.openid.net/extensions/pape/1.0", "openid.pape.auth_time"=>"2012-03-06T07:16:09Z", "openid.signed"=>"assoc_handle,identity,response_nonce,return_to,claimed_id,op_endpoint,ns.sreg,sreg.nickname,sreg.email,sreg.fullname,ns.pape,pape.auth_policies,pape.auth_time", "openid.ns.sreg"=>"http://openid.net/extensions/sreg/1.1", "openid.return_to"=>"http://114.113.197.25:3000/consumer/complete?did_sreg=y"} Redirected to http://114.113.197.25:3000/consumer Completed 302 Found in 3ms (ActiveRecord: 0.0ms)
Started GET "/consumer" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Processing by ConsumerController#index as HTML Rendered consumer/index.html within layouts/application (0.3ms) Completed 200 OK in 3ms (Views: 3.0ms | ActiveRecord: 0.0ms)
Started GET "/assets/application.css?body=1" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Served asset /application.css - 304 Not Modified (0ms) [2012-03-06 18:12:32] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started GET "/assets/jquery_ujs.js?body=1" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Served asset /jquery_ujs.js - 304 Not Modified (0ms) [2012-03-06 18:12:32] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started GET "/assets/application.js?body=1" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Served asset /application.js - 304 Not Modified (0ms) [2012-03-06 18:12:32] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Started GET "/assets/jquery.js?body=1" for 218.107.55.254 at 2012-03-06 18:12:32 +0800 Served asset /jquery.js - 304 Not Modified (0ms) [2012-03-06 18:12:32] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
*** /usr/local/ruby/lib/ruby/gems/1.9.1/gems/ruby-openid-2.1.8/lib/openid/consumer/idres.rb 2012-03-06 15:13:54.000000000 +0800
--- /home/tiredboy/login/gem/ruby/1.9.1/gems/ruby-openid-2.1.8/lib/openid/consumer/idres.rb 2012-03-07 13:25:58.000000000 +0800
***************
*** 170,175 ****
--- 170,178 ----
end
#message.get_args(BARE_NS).each_pair do |bare_key, bare_val|
rt_val = return_to_parsed_query[bare_key]
+ if bare_key == "controller" or bare_key == "action"
+ next
+ end
if not return_to_parsed_query.has_key? bare_key
# This may be caused by your web framework throwing extra
# entries in to your parameters hash that were not GET or
i ignore controller and action as temporary solution
It's problem created by Rails, it sometimes adds some parameters like "controller" and "action" in the url.
Instead of modifying the source of idres.rb, you can modify your Rails controller in which you manage the return call in this way:
parameters = params.reject{|k,v|request.path_parameters[k]}.reject{|k,v| k == 'action' || k == 'controller'}
like I found in an issue on the ruby-openid gem on GitHub
This solved the problem for me.
I'm upgrading an app to Rails 3.1. Quote often, Firebug will complain about some assets. Here are some errors pasted from Firebug:
"NetworkError: 500 Internal Server Error - http://unstilted.dev/assets/jquery-ui.js?body=1"
jquery...?body=1
"NetworkError: 500 Internal Server Error - http://unstilted.dev/assets/admin/pages/file_attachments.js"
file_a...ents.js
"NetworkError: 500 Internal Server Error - http://unstilted.dev/assets/admin/file_attachments/sortable.js?body=1"
sortab...?body=1
"NetworkError: 500 Internal Server Error - http://unstilted.dev/assets/jquery.js?body=1"
Refreshing the page would yield different assets showing the same error. When I copy and paste the URL I see the files just fine.
I'm using:
Ubuntu 11.04
Apache+Passenger 3.0.9
How do I fix this?
UPDATE: Log file
In this particular instance, jquery-ui.js was showing an error in Firebug. My log file looked like this:
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at Tue Sep 06 22:24:39 +0800 2011
Served asset /jquery.js - 304 Not Modified (0ms)
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at Tue Sep 06 22:24:39 +0800 2011
Started GET "/admin/site/sites/storage.js" for 127.0.0.1 at Tue Sep 06 22:24:39 +0800 2011
Served asset /jquery_ujs.js - 304 Not Modified (0ms)
Started GET "/assets/application.js?body=1" for 127.0.0.1 at Tue Sep 06 22:24:39 +0800 2011
Processing by Admin::Site::SitesController#storage as JS
Served asset /application.js - 304 Not Modified (3ms)
...
Rendered admin/site/sites/storage.js.erb (0.1ms)
Completed 200 OK in 58ms (Views: 5.1ms | ActiveRecord: 21.1ms)
Started GET "/assets/admin/logo.png" for 127.0.0.1 at Tue Sep 06 22:24:39 +0800 2011
Served asset /admin/logo.png - 304 Not Modified (0ms)
It seems to have skipped jquery-ui.js!
UPDATE Oct 1, 2011:
I tried it out with the standalone passenger (passenger start) as it seems to give a more descriptive error. This is what happens when I try to load just the jquery.js file and press CTRL-R repeatedly to refresh my browser and load that asset repeatedly.
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-10-01 21:40:18 +0800
[ pid=29485 thr=3066030960 file=ext/nginx/HelperAgent.cpp:931 time=2011-10-01 21:40:18.691 ]: Uncaught exception in PassengerServer client thread:
exception: Cannot read response from backend process: Connection reset by peer (104)
backtrace:
in 'void Client::forwardResponse(Passenger::SessionPtr&, Passenger::FileDescriptor&, const Passenger::AnalyticsLogPtr&)' (HelperAgent.cpp:603)
in 'void Client::handleRequest(Passenger::FileDescriptor&)' (HelperAgent.cpp:857)
in 'void Client::threadMain()' (HelperAgent.cpp:950)
2011/10/01 21:40:18 [error] 29522#0: *16 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET /assets/jquery.js?body=1 HTTP/1.1", upstream: "passenger:unix:/passenger_helper_server:", host: "get.unstilted.dev:3000"
[ pid=29674 thr=78131090 file=utils.rb:176 time=2011-10-01 21:40:18.699 ]: *** Exception PGError in application (server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
) (process 29674, thread #<Thread:0x9505f24>):
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:276:in `exec'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:276:in `block in clear_cache!'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:275:in `each_value'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:275:in `clear_cache!'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:303:in `disconnect!'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:202:in `block in disconnect!'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:201:in `each'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:201:in `disconnect!'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activesupport-3.1.0/lib/active_support/core_ext/module/synchronization.rb:35:in `block in disconnect_with_synchronization!'
from /home/ramon/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activesupport-3.1.0/lib/active_support/core_ext/module/synchronization.rb:34:in `disconnect_with_synchronization!'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:395:in `block in clear_all_connections!'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:395:in `each_value'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:395:in `clear_all_connections!'
from /home/ramon/.rvm/gems/ruby-1.9.2-p290#unstilted/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `clear_all_connections!'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/utils.rb:398:in `before_handling_requests'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/rack/application_spawner.rb:204:in `start_request_handler'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/rack/application_spawner.rb:170:in `block in handle_spawn_application'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/utils.rb:479:in `safe_fork'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/rack/application_spawner.rb:165:in `handle_spawn_application'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/abstract_server.rb:180:in `start'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/rack/application_spawner.rb:128:in `start'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
from <internal:prelude>:10:in `synchronize'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /home/ramon/.passenger/standalone/3.0.9-x86-ruby1.9.2-linux-gcc4.5.2-1002/support/helper-scripts/passenger-spawn-server:99:in `<main>'
Served asset /jquery.js - 304 Not Modified (0ms)
cache: [GET /assets/jquery.js?body=1] stale, valid, store
[ pid=29485 thr=3064224624 file=ext/nginx/HelperAgent.cpp:921 time=2011-10-01 21:40:18.734 ]: Couldn't forward the HTTP response back to the HTTP client: It seems the user clicked on the 'Stop' button in his browser.
The problem is in the middle of Passenger and Rails 3.1 PostgreSQL adapter.
According to this issue https://github.com/rails/rails/issues/1339
Rails 3.1.1.rc1 should have this issue fixed.
Also stop using PassengerSpawnMethod conservative because it makes Passenger & eventually REE performance optimizations useless - it spawns separate Rails instances - no sharing of common code.
I had the same issue. For me I think it was some cached assets or something.
I ran
rake assets:clean
and then requested the page again. This generated real error messages I could use to debug.
It turned out that one of my JS files still had the old require syntax with <>s.
Hope this solves your problem too, I know it was frustrating!
The quick fix is to tell passenger to use the 'conservative' spawn method.
in your apache2.conf
PassengerSpawnMethod conservative