From a08636598c8d6bf069653315ffcf6756f7a54db4 Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Mon, 11 Oct 2010 04:13:15 -0400 Subject: [PATCH] Added conditional to front page photo. --- app/views/pages/index.html.erb | 2 +- log/development.log | 286 +++++++++++++++++++++++++++++++++ 2 files changed, 287 insertions(+), 1 deletion(-) diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb index b62261b..53ff8ff 100644 --- a/app/views/pages/index.html.erb +++ b/app/views/pages/index.html.erb @@ -6,7 +6,7 @@ -
+
diff --git a/log/development.log b/log/development.log index 60da236..2ec34f1 100644 --- a/log/development.log +++ b/log/development.log @@ -23746,3 +23746,289 @@ Processing PagesController#index (for 127.0.0.1 at 2010-10-11 03:01:22) [GET] Rendering template within layouts/photos Rendering pages/index Completed in 15ms (View: 7, DB: 1) | 200 OK [http://localhost/] + + +Processing PagesController#index (for 127.0.0.1 at 2010-10-11 04:10:48) [GET] + Photo Load (0.5ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 1 +Rendering template within layouts/photos +Rendering pages/index + +ActionView::TemplateError (undefined method `photo' for nil:NilClass) on line #9 of app/views/pages/index.html.erb: +6:
+7:
+8: +9:
+10:
+11: +12:
+ + app/views/pages/index.html.erb:9 + +Rendered rescues/_trace (28.6ms) +Rendered rescues/_request_and_response (1.1ms) +Rendering rescues/layout (internal_server_error) + + +Processing PagesController#index (for 127.0.0.1 at 2010-10-11 04:11:15) [GET] + Photo Load (0.4ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 1 +Rendering template within layouts/photos +Rendering pages/index + +ActionView::TemplateError (undefined method `photo' for nil:NilClass) on line #9 of app/views/pages/index.html.erb: +6:
+7: +8: +9:
+10:
+11: +12:
+ + app/views/pages/index.html.erb:9 + +Rendered rescues/_trace (26.2ms) +Rendered rescues/_request_and_response (0.4ms) +Rendering rescues/layout (internal_server_error) + + +Processing PagesController#index (for 127.0.0.1 at 2010-10-11 04:11:35) [GET] + Photo Load (0.4ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 1 +Rendering template within layouts/photos +Rendering pages/index +ERROR: compiling _run_erb_app47views47pages47index46html46erb RAISED compile error +/Users/danbee/Sites/rails/photos/app/views/pages/index.html.erb:9: syntax error, unexpected tIVAR, expecting kTHEN or ':' or '\n' or ';' +...fer.concat(( if @photos @photo.photo.url(:size17) ).to_s); @... + ^ +Function body: def _run_erb_app47views47pages47index46html46erb(local_assigns) + old_output_buffer = output_buffer;;@output_buffer = ''; __in_erb_template=true ; @output_buffer.concat "\t
\n\t\t" +; @output_buffer.concat(( link_to '
about
', :action => 'about' ).to_s); @output_buffer.concat "\n\t
\n\t
\n\t\t" + + +; @output_buffer.concat(( link_to '
portfolio
', :controller => 'categories' ).to_s); @output_buffer.concat "\n\t
\n
\n\n
\n
\n\n
\n
\n
\n
\n
\n\t" + + + + + + + +; @output_buffer.concat(( link_to '
contact
', :action => 'contact' ).to_s); @output_buffer.concat "\n
\n" + +; @output_buffer + ensure + self.output_buffer = old_output_buffer + end +Backtrace: /Users/danbee/Sites/rails/photos/app/views/pages/index.html.erb:22:in `compile!' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_view/renderable.rb:61:in `compile' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_view/renderable.rb:28:in `render' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_view/template.rb:205:in `render_template' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_view/base.rb:265:in `render_without_parent' +/Users/danbee/Sites/rails/photos/vendor/plugins/typus/lib/vendor/inherit_views.rb:193:in `render' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_view/base.rb:348:in `_render_with_layout' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_view/base.rb:262:in `render_without_parent' +/Users/danbee/Sites/rails/photos/vendor/plugins/typus/lib/vendor/inherit_views.rb:193:in `render' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:1250:in `render_for_file' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:936:in `render_without_benchmark' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:51:in `render' +/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `ms' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime' +/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `ms' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:51:in `render' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:1326:in `default_render' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:1332:in `perform_action_without_filters' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/filters.rb:617:in `call_filters' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' +/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `ms' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime' +/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `ms' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/rescue.rb:160:in `perform_action_without_flash' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/flash.rb:151:in `perform_action' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in `send' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in `process_without_filters' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/filters.rb:606:in `process' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:391:in `process' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:386:in `call' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:438:in `call' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:87:in `dispatch' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:121:in `_call' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack' +/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:29:in `call' +/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:29:in `call' +/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache' +/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:9:in `cache' +/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:28:in `call' +/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/string_coercion.rb:25:in `call' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/head.rb:9:in `call' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in `call' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/params_parser.rb:15:in `call' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/session/cookie_store.rb:99:in `call' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/failsafe.rb:26:in `call' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `synchronize' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:114:in `call' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/reloader.rb:34:in `run' +/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:108:in `call' +/Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/rails/rack/static.rb:31:in `call' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:47:in `call' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `each' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `call' +/Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/rails/rack/log_tailer.rb:17:in `call' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in `call' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/chunked.rb:15:in `call' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:67:in `process' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' +/Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:38:in `run' +/Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:111 +/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' +/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' +script/server:3 + +ActionView::TemplateError (compile error +/Users/danbee/Sites/rails/photos/app/views/pages/index.html.erb:9: syntax error, unexpected tIVAR, expecting kTHEN or ':' or '\n' or ';' +...fer.concat(( if @photos @photo.photo.url(:size17) ).to_s); @... + ^) on line #9 of app/views/pages/index.html.erb: +6: +7: +8: +9:
+10:
+11: +12:
+ + app/views/pages/index.html.erb:22:in `compile!' + +Rendered rescues/_trace (23.5ms) +Rendered rescues/_request_and_response (0.3ms) +Rendering rescues/layout (internal_server_error) + + +Processing PagesController#index (for 127.0.0.1 at 2010-10-11 04:11:56) [GET] + Photo Load (0.4ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 1 +Rendering template within layouts/photos +Rendering pages/index + +ActionView::TemplateError (You have a nil object when you didn't expect it! +You might have expected an instance of Array. +The error occurred while evaluating nil.empty?) on line #9 of app/views/pages/index.html.erb: +6:
+7: +8: +9:
+10:
+11: +12:
+ + app/views/pages/index.html.erb:9 + +Rendered rescues/_trace (25.9ms) +Rendered rescues/_request_and_response (0.2ms) +Rendering rescues/layout (internal_server_error) + + +Processing PagesController#index (for 127.0.0.1 at 2010-10-11 04:12:07) [GET] + Photo Load (0.4ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 1 +Rendering template within layouts/photos +Rendering pages/index +Completed in 35ms (View: 29, DB: 0) | 200 OK [http://localhost/] + + +Processing PagesController#index (for 127.0.0.1 at 2010-10-11 04:12:07) [GET] + Photo Load (0.4ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 1 +Rendering template within layouts/photos +Rendering pages/index +Completed in 11ms (View: 3, DB: 0) | 200 OK [http://localhost/] + + +Processing PagesController#about (for 127.0.0.1 at 2010-10-11 04:12:42) [GET] +Rendering template within layouts/photos +Rendering pages/about +Completed in 22ms (View: 21, DB: 0) | 200 OK [http://localhost/about] + + +Processing PagesController#index (for 127.0.0.1 at 2010-10-11 04:12:44) [GET] + Photo Load (0.4ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 1 +Rendering template within layouts/photos +Rendering pages/index +Completed in 7ms (View: 2, DB: 0) | 200 OK [http://localhost/] + + +Processing PagesController#index (for 127.0.0.1 at 2010-10-11 04:12:44) [GET] + Photo Load (0.4ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 1 +Rendering template within layouts/photos +Rendering pages/index +Completed in 10ms (View: 3, DB: 0) | 200 OK [http://localhost/] + + +Processing CategoriesController#index (for 127.0.0.1 at 2010-10-11 04:12:44) [GET] + Category Load (0.6ms) SELECT * FROM "categories" LIMIT 4 OFFSET 0 + SQL (0.1ms) SELECT count(*) AS count_all FROM "categories"  + Photo Load (0.2ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 2 +Rendering template within layouts/photos +Rendering categories/index +Completed in 17ms (View: 8, DB: 1) | 200 OK [http://localhost/categories] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-11 04:12:46) [GET] + Parameters: {"category_id"=>"1"} + Category Load (0.2ms) SELECT * FROM "categories" WHERE ("categories"."id" = '1') LIMIT 1 + Photo Load (0.2ms) SELECT * FROM "photos" INNER JOIN "categories_photos" ON "photos".id = "categories_photos".photo_id WHERE ("categories_photos".category_id = 1 ) LIMIT 11 OFFSET 0 +Rendering template within layouts/photos +Rendering photos/index +Completed in 23ms (View: 13, DB: 0) | 200 OK [http://localhost/categories/1/photos] + + +Processing CategoriesController#index (for 127.0.0.1 at 2010-10-11 04:12:51) [GET] + Category Load (0.6ms) SELECT * FROM "categories" LIMIT 4 OFFSET 0 + SQL (0.1ms) SELECT count(*) AS count_all FROM "categories"  + Photo Load (0.2ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 2 +Rendering template within layouts/photos +Rendering categories/index +Completed in 13ms (View: 4, DB: 1) | 200 OK [http://localhost/categories] + + +Processing CategoriesController#index (for 127.0.0.1 at 2010-10-11 04:12:55) [GET] + Parameters: {"page"=>"2"} + Category Load (0.6ms) SELECT * FROM "categories" LIMIT 4 OFFSET 4 + Photo Load (0.1ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 2 +Rendering template within layouts/photos +Rendering categories/index +Completed in 12ms (View: 4, DB: 1) | 200 OK [http://localhost/categories?page=2] + + +Processing PhotosController#index (for 127.0.0.1 at 2010-10-11 04:12:56) [GET] + Parameters: {"category_id"=>"5"} + Category Load (0.2ms) SELECT * FROM "categories" WHERE ("categories"."id" = '5') LIMIT 1 + Photo Load (0.2ms) SELECT * FROM "photos" INNER JOIN "categories_photos" ON "photos".id = "categories_photos".photo_id WHERE ("categories_photos".category_id = 5 ) LIMIT 11 OFFSET 0 +Rendering template within layouts/photos +Rendering photos/index +Completed in 63ms (View: 54, DB: 0) | 200 OK [http://localhost/categories/5/photos] + + +Processing PagesController#index (for 127.0.0.1 at 2010-10-11 04:12:57) [GET] + Photo Load (0.5ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 1 +Rendering template within layouts/photos +Rendering pages/index +Completed in 12ms (View: 4, DB: 0) | 200 OK [http://localhost/] + + +Processing PagesController#index (for 127.0.0.1 at 2010-10-11 04:12:57) [GET] + Photo Load (0.4ms) SELECT * FROM "photos" ORDER BY RANDOM() LIMIT 1 +Rendering template within layouts/photos +Rendering pages/index +Completed in 8ms (View: 2, DB: 0) | 200 OK [http://localhost/]