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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
hj wrote in post #1049623:> I was reading the book "Agile Web Development with Rails 4th Edition". > In Chapter 11, Iteration C2: Adding a Page Layout> "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?First of all I would suggest that if you''re learning Rails from a book, then install the version of Rails that the book is using. It will save you a lot of headaches like this as you learn. Once you have a good handle on Rails then investigate the changes made in subsequent releases. There are release notes for each version that will explain things. However, the easiest way to discover things like this is to generate a new project. Then generate a scaffold and go into the files and see what they use. Example: $ rails new demo $ cd demo $ rails g scaffold Person name:string app/views/layouts/application.html.erb ------------------------------------- <!DOCTYPE html> <html> <head> <title>Demo</title> <%= stylesheet_link_tag "application", :media => "all" %> <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> </head> <body> <%= yield %> </body> </html> Keep in mind though that Rails 3.1+ is going to use the new asset pipeline, which your rails book will know nothing about. So if you want to continue to use Rails 3.2.1 with your book you''ll first have to know about what has changed since 3.0.5. Again I strongly recommend you roll back to Rails 3.0.5 while learning from that book. gem install rails --version="~> 3.0" -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.