I've written a very small program to help me learn ruby. Below is the error I get from the server logs.
This is the URL I am trying from browser and followed errors: localhost:3000/say/hello
Started GET "/say/hello" for 127.0.0.1 at Sun Jun 10 14:28:45 +0800 2012
ActionController::RoutingError (No route matches [GET] "/say/hello"):
actionpack (3.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.5) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.5) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.5) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.5) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.5) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.5) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.5) lib/rails/engine.rb:479:in `call'
railties (3.2.5) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.5) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.4.1) lib/rack/handler/webrick.rb:13:in `run'
rack (1.4.1) lib/rack/server.rb:265:in `start'
railties (3.2.5) lib/rails/commands/server.rb:70:in `start'
railties (3.2.5) lib/rails/commands.rb:55
railties (3.2.5) lib/rails/commands.rb:50:in `tap'
railties (3.2.5) lib/rails/commands.rb:50
script/rails:6:in `require'
script/rails:6
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.4ms)
This is my Gemfile content
source 'https://rubygems.org'
gem 'rails', '3.2.5'
gem 'sqlite3'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
I've had a look at a few other SO threads, but none seem to relate specifically to my problem.
In your routes.rb you need either:
match "say/hello" => "myController#myaction" (replacing controller and action with proper values)
or
match ':controller(/:action(/:id))(.:format)' Which will allow you to use code like: link_to "hello", :controller => "mycontroller", :action => "myaction" or enter the URL (like /say/hello)
The former is the preferred method because users cannot go to urls you don't want them to.
Also, your view should be in a subdirectory with the name of the controller that will be using it, not in the actual 'views' directory
EDIT:
Looking at answer below you need to make your file an html.erb not rhtml
Type bundle execute rake routes to list all the routing paths in your application. Check if :controller=>"say", :action=>"hello" there.
Also this doesn't follow the restful rules of rails, so you maybe need to uncomment the match ':controller(/:action(/:id))(.:format)', which at the last line of config/routes.rb.
Related
The oAuth process works fine on Heroku, but I cannot get it to work locally. My app sends a user through the oAuth process, but the callback never makes it to the controller (tested by putting a pry in the create method of the controller it should be reaching). The weird thing is that it used to work locally. I've even reverted back to when it was working to no avail. Any help would be much appreciated!
EDIT: I created a brand new app, and the same problem exists. This must be something with my computer/network. Any ideas?
Terminal
Started GET "/auth/google_oauth2" for ::1 at 2017-03-09 22:38:58 -0700
I, [2017-03-09T22:38:58.613208 #40471] INFO -- omniauth:(google_oauth2) Request phase initiated.
Started GET "/auth/google_oauth2/callback?state=abunchofrandomnumbers&code=morerandomnumbers" for ::1 at 2017-03-09 22:38:59 -0700
I, [2017-03-09T22:38:59.492677 #40471] INFO -- omniauth: (google_oauth2) Callback phase initiated.
Faraday::ConnectionFailed (execution expired)
config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, ENV['youtube_id'], ENV['youtube_secret'], scope: 'userinfo.profile,youtube'
end
routes.rb
get '/auth/:provider/callback', to: 'youtube_users#create'
Gemfile
gem 'rails', '~> 5.0.1'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.5'
gem 'bcrypt', '~> 3.1.7'
gem 'figaro'
gem 'faraday'
gem 'bootstrap-sass'
gem 'yt'
gem 'omniauth-google-oauth2'
gem 'rails-html-sanitizer'
gem 'bootstrap_form'
Google Dev Console Credentials
Origin: http://localhost:3000
Redirect URI: http://localhost:3000/auth/google_oauth2/callback
Image of errors in browser
development.log
Started GET "/auth/google_oauth2" for ::1 at 2017-03-12 00:45:13 -0700
(google_oauth2) Request phase initiated.
Started GET "/auth/google_oauth2/callback?state=ecc60cda112ce1f74a28318ac2f2e148debe8afde204d307&code=4/9aFUvRVFluC7fwiDXkstbjZVoiWj684ViSbObLIfSsQ" for ::1 at 2017-03-12 00:45:16 -0700
(google_oauth2) Callback phase initiated.
Faraday::ConnectionFailed (execution expired):
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:880:in `initialize'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:880:in `open'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:880:in `block in connect'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:878:in `connect'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:852:in `start'
/Users/brad/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:1398:in `request'
faraday (0.11.0) lib/faraday/adapter/net_http.rb:80:in `perform_request'
faraday (0.11.0) lib/faraday/adapter/net_http.rb:38:in `block in call'
faraday (0.11.0) lib/faraday/adapter/net_http.rb:85:in `with_net_http_connection'
faraday (0.11.0) lib/faraday/adapter/net_http.rb:33:in `call'
faraday (0.11.0) lib/faraday/request/url_encoded.rb:15:in `call'
faraday (0.11.0) lib/faraday/rack_builder.rb:139:in `build_response'
faraday (0.11.0) lib/faraday/connection.rb:377:in `run_request'
oauth2 (1.3.1) lib/oauth2/client.rb:99:in `request'
oauth2 (1.3.1) lib/oauth2/client.rb:146:in `get_token'
oauth2 (1.3.1) lib/oauth2/strategy/auth_code.rb:30:in `get_token'
omniauth-google-oauth2 (0.4.1) lib/omniauth/strategies/google_oauth2.rb:107:in `custom_build_access_token'
omniauth-oauth2 (1.4.0) lib/omniauth/strategies/oauth2.rb:73:in `callback_phase'
omniauth (1.6.1) lib/omniauth/strategy.rb:230:in `callback_call'
omniauth (1.6.1) lib/omniauth/strategy.rb:187:in `call!'
omniauth (1.6.1) lib/omniauth/strategy.rb:167:in `call'
omniauth (1.6.1) lib/omniauth/builder.rb:63:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.2) lib/active_record/migration.rb:553:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.2) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.2) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.2) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.2) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.2) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.2) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.2) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.2) lib/rails/engine.rb:522:in `call'
puma (3.8.1) lib/puma/configuration.rb:224:in `call'
puma (3.8.1) lib/puma/server.rb:590:in `handle_request'
puma (3.8.1) lib/puma/server.rb:425:in `process_client'
puma (3.8.1) lib/puma/server.rb:289:in `block in run'
puma (3.8.1) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
Rendering /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (4.1ms)
Rendering /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (4.9ms)
Rendering /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.7ms)
Rendered /Users/brad/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (95.2ms)
You may want to first check if you have already specified your localhost port and added /oauth2callback in your Developers Console as shown in the image below. See if it works.
Otherwise, check the full documentation of OpenID Connect, wherein it was mentioned in The Discovery document that:
The OpenID Connect protocol requires the use of multiple endpoints for authenticating users, and for requesting resources including tokens, user information, and public keys.
To simplify implementations and increase flexibility, OpenID Connect allows the use of a "Discovery document," a JSON document found at a well-known location containing key-value pairs which provide details about the OpenID Connect provider's configuration, including the URIs of the authorization, token, userinfo, and public-keys endpoints.
With this, you may want to also use the following configuration as given in this GitHub post:
export OAUTH_AUTHORIZATION_URL="https://accounts.google.com/o/oauth2/v2/auth"
export OAUTH_TOKEN_URL="https://www.googleapis.com/oauth2/v4/token"
export OAUTH_USERINFO_URL="https://www.googleapis.com/oauth2/v3/userinfo"
export OAUTH_CLIENT_ID="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.apps.googleusercontent.com"
export OAUTH_CLIENT_SECRET="BBBBBBBBBBBBBBBBBBBBBBBB"
export OAUTH_CALLBACK_URL="http://localhost:7100/auth/oauth/callback"
export OAUTH_SCOPE="openid email"
# Now you can just run stf local without the annoying auth options.
stf local --auth-type oauth
Hope that helps
I have taken an existing site. Integrated a CMS (Comfortable Mexican Sofa). Then installed Redactor. Threw Redactor I have the ability to add content and display it on localhost:3000. I also have the ability to upload Files. I run into a problem using its insert image function in the content box.
My server log:
Started POST "/admin/sites/2/pages/2/null?ajax=1" for 127.0.0.1 at 2015-09-22 01:26:44 -0400
ActionController::RoutingError (No route matches [POST] "/admin/sites/2/pages/2/null"):
actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.3) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.3) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.3) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.3) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.0.3) lib/rails/engine.rb:511:in `call'
railties (4.0.3) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/Users/bam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/Users/bam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/Users/bam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
My Gemfile's relevent Gems (I did not add imagemagick to the Gemfile although I have installed it).
ruby '2.0.0'
gem 'rails', '4.0.3'
gem "paperclip", "~> 4.3.0"
gem 'comfortable_mexican_sofa', '~> 1.12.0'
gem 'kaminari'
config/environments/development
# Per https://github.com/thoughtbot/paperclip
Paperclip.options[:command_path] = "/usr/bin/"
routes
comfy_route :cms_admin, :path => '/admin'
# Make sure this routeset is defined last
comfy_route :cms, :path => '/', :sitemap => false
config/initializers/paperclip.rb
Paperclip.options[:command_path] = "/usr/bin/"
When I file upload and it is successful this is the first two lines of the server log where the difference occurs is on line 2.
Started POST "/admin/sites/2/files?ajax=true" for 127.0.0.1 at 2015-09-22 01:48:10 -0400
Processing by Comfy::Admin::Cms::FilesController#create as HTML
Feel Free to checkout out the repo I was not sure how do demonstrate the files that Redactor added. https://github.com/jpbamberg1993/aqqaluk the branch it "redactor".
Do not hesitate to critique this post it is my first one.
Thank You
Turns out that the new version of Comfortable Mexican Sofa comes with redactor. Based on our Ruby version it was defaulting to the older version. Upgrading the gemset solved the problem.
https://github.com/comfy/comfortable-mexican-sofa/tree/v1.12.6
Another alternative that was presented to me was to "You can upload the image in the Files section of the admin, then refer to the image in your default page editor. After you upload an image, CMS adds an “uploaded files” module to the right of your editor where you can copy-and-paste image URLs to create <image> tags." Ed Toro
I've included the arbor-rails gem in my Rails 3.2.8 application and it works fine in development mode, but in production I get the following error:
Started GET "/nullarbor.js" for 127.0.0.1 at 2012-09-20 15:35:23 -0700
ActionController::RoutingError (No route matches [GET] "/nullarbor.js"):
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in `call'
thin (1.4.1) lib/thin/connection.rb:80:in `block in pre_process'
thin (1.4.1) lib/thin/connection.rb:78:in `catch'
thin (1.4.1) lib/thin/connection.rb:78:in `pre_process'
thin (1.4.1) lib/thin/connection.rb:53:in `process'
thin (1.4.1) lib/thin/connection.rb:38:in `receive_data'
eventmachine (1.0.0) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.0) lib/eventmachine.rb:187:in `run'
thin (1.4.1) lib/thin/backends/base.rb:63:in `start'
thin (1.4.1) lib/thin/server.rb:159:in `start'
rack (1.4.1) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.1) lib/rack/server.rb:265:in `start'
railties (3.2.8) lib/rails/commands/server.rb:70:in `start'
railties (3.2.8) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.8) lib/rails/commands.rb:50:in `tap'
railties (3.2.8) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
I've gone through the settings in environments/ and discovered that when I set the following in development.rb:
config.assets.debug = false
I get the error in dev mode, too. And when I set it to true in production it works properly. What could be causing this?
Update: It seems to actually be something to do with the arbor_path function in arbor.js.
arbor.js uses a web worker which means that you need to provide the Worker creation with the appropriate link to where the arbor.js script will be.
What you could do to solve this problem is to provide the absolute path to your arbor.js file instead of letting the code use the arbor_path function that can be messed up by your caching logic or the way you serve js files.
In other words, try to replace
i=new Worker(arbor_path()+"arbor.js");
with
i=new Worker("/final/path/to/arbor.js");
in arbor.js
As #Asimov4 stated, the problem is produced on the following call:
new Worker(arbor_path()+"arbor.js");
Nonetheless, a more elegant solution, compatible with the precompilation of assets, is to change it to:
new Worker("<%= asset_path('arbor.js') %>");
Note: Remember to change the .js file to .js.erb!
OS: openSUSE 11.4
Rails 3.2.0
I just created a very simple application "koko". Here are the order of commands I ran
rails new koko
rails generate model Story name:string description:string
rake db:migrate
rails generate controller Stories index
All above commands executed successfully.
I then ran =>rails server to start the server.
localhost:3000/ works fine.
When i try to do
localhost:3000/stores I get the following error: (the browser displayes the first line about No route matches)
Started GET "/stories" for 127.0.0.1 at Sat Aug 04 12:52:02 -0400 2012
ActionController::RoutingError (No route matches [GET] "/stories"):
actionpack (3.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.0) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.0) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.0) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.0) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.0) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.0) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.2.0) lib/rails/engine.rb:479:in `call'
railties (3.2.0) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.0) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.4.1) lib/rack/handler/webrick.rb:13:in `run'
rack (1.4.1) lib/rack/server.rb:265:in `start'
railties (3.2.0) lib/rails/commands/server.rb:70:in `start'
railties (3.2.0) lib/rails/commands.rb:55
railties (3.2.0) lib/rails/commands.rb:50:in `tap'
railties (3.2.0) lib/rails/commands.rb:50
script/rails:6:in `require'
script/rails:6
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.2.0/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.9ms)
Your issue is that you are trying to use a RESTful interface to a non-RESTful resource. You made a model, and you made a controller with an index action, (/controller_name/action).
If you are happy with using /stories/index, then we're done! If you prefer the more traditional RESTful interface /stories, then I would suggest using:
rails generate resource ModelName fields:types.
This will create a Model and a Controller, and should work restfully out of the box. This will set up the route that was mentioned in the comments.
Hope this helps!
You might simply have some naming problems. Generally, when creating a controller it should be
rails g controller stories index
or
rails g controller Story index
Then change your automatically-generated route to
match "/stories" => "stories#index", :as => "stories"
In my rails application I am using mobile-fu and jquery mobile ui. every thing works fine when I tested mobile UI through desktop browser. When I use to test my app through mobile browser I am seeing routing errors for all assets in development.log and its shows. every thing works fine in mobile broswer.
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-06-12 15:02:00 +0530
Served asset /jquery.js - 304 Not Modified (0ms)
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-06-12 15:02:00 +0530
ActionController::RoutingError (No route matches [GET] "/jquery.js"):
actionpack (3.2.2) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.2) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.2) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.2) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/static.rb:61:in `call'
railties (3.2.2) lib/rails/engine.rb:479:in `call'
railties (3.2.2) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.2) lib/rails/rack/log_tailer.rb:14:in `call'
thin (1.3.1) lib/thin/connection.rb:80:in `block in pre_process'
thin (1.3.1) lib/thin/connection.rb:78:in `catch'
thin (1.3.1) lib/thin/connection.rb:78:in `pre_process'
thin (1.3.1) lib/thin/connection.rb:53:in `process'
thin (1.3.1) lib/thin/connection.rb:38:in `receive_data'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
thin (1.3.1) lib/thin/backends/base.rb:61:in `start'
thin (1.3.1) lib/thin/server.rb:159:in `start'
rack (1.4.1) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.1) lib/rack/server.rb:265:in `start'
railties (3.2.2) lib/rails/commands/server.rb:70:in `start'
railties (3.2.2) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.2) lib/rails/commands.rb:50:in `tap'
railties (3.2.2) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
Rendered /usr/local/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.8ms)
Here is the code I am using
application_controller.rb
has_mobile_fu
...
mobile.js
//= require jquery
//= require jquery_ujs
//= require 'jquery.mobile'
//= require_self
mobile.css
*= require 'jquery.mobile'
*= require_self
application.mobile.erb
<%= stylesheet_link_tag "mobile" %>
<%= javascript_include_tag "mobile" %>
How to fix routing issues