Ruby on Rails Wednesday, February 29, 2012

I was reading the book "Agile Web Development with Rails 4th Edition".
In Chapter 11, Iteration C2: Adding a Page Layout
1 <!DOCTYPE html>
- <html>
- <head>
- <title>Pragprog Books Online Store</title>
5 <%= stylesheet_link_tag "scaffold" %>
- <%= stylesheet_link_tag "depot", :media => "all" %>
- <%= javascript_include_tag :defaults %>
- <%= csrf_meta_tag %>
- </head>

"stylesheet_link_tag" and "javascript_include_tag" dosn't work. My
Rails version is 3.2.1. The book was written using Rails 3.0.5.
How to modify stylesheet_link_tag parameters to fit Rails 3.2.1?

My files

hj@debian:~/depot$ ls app/assets/stylesheets/
application.css depot.css products.css.scss store.css.scss
carts.css.scss line_items.css.scss scaffolds.css.scss

hj@debian:~/depot$ ls app/assets/javascripts/
application.js depot.css products.js.coffee
carts.js.coffee line_items.js.coffee store.js.coffee
hj@debian:~/depot$

rails server outputs
Started GET "/assets/scaffold.css" for 127.0.0.1 at 2012-03-01
09:44:21 +0800
Served asset /scaffold.css - 404 Not Found (5ms)

ActionController::RoutingError (No route matches [GET] "/assets/
scaffold.css"):
actionpack (3.2.1) lib/action_dispatch/middleware/
debug_exceptions.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:
56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) 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.1) 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.1) lib/action_dispatch/middleware/static.rb:53:in
`call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/home/hj/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/
httpserver.rb:138:in `service'
/home/hj/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/
httpserver.rb:94:in `run'
/home/hj/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/server.rb:
191:in `block in start_thread'


Rendered /home/hj/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.1/lib/
action_dispatch/middleware/templates/rescues/routing_error.erb within
rescues/layout (1.2ms)


Started GET "/assets/defaults.js" for 127.0.0.1 at 2012-03-01 09:44:21
+0800
Served asset /defaults.js - 404 Not Found (5ms)

ActionController::RoutingError (No route matches [GET] "/assets/
defaults.js"):
actionpack (3.2.1) lib/action_dispatch/middleware/
debug_exceptions.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:
56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) 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.1) 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.1) lib/action_dispatch/middleware/static.rb:53:in
`call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/home/hj/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/
httpserver.rb:138:in `service'
/home/hj/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/
httpserver.rb:94:in `run'
/home/hj/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/server.rb:
191:in `block in start_thread'


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment