Commit 9628a907ba3bc6c449949e58919bdb3aa1a66ed2
1 parent
2a250870
Exists in
master
and in
23 other branches
ActionItem1205: trying to expose the problem
Showing
2 changed files
with
33 additions
and
24 deletions
Show diff stats
app/helpers/application_helper.rb
| ... | ... | @@ -311,22 +311,35 @@ module ApplicationHelper |
| 311 | 311 | end |
| 312 | 312 | |
| 313 | 313 | def current_theme |
| 314 | - return session[:theme] if (session[:theme]) | |
| 315 | - | |
| 316 | - # utility for developers: set the theme to 'random' in development mode and | |
| 317 | - # you will get a different theme every request. This is interesting for | |
| 318 | - # testing | |
| 319 | - if ENV['RAILS_ENV'] == 'development' && @environment.theme == 'random' | |
| 320 | - @theme ||= Dir.glob('public/designs/themes/*').map { |f| File.basename(f) }.rand | |
| 321 | - return @theme | |
| 322 | - end | |
| 323 | - | |
| 324 | - p = profile | |
| 325 | - if p | |
| 326 | - p.theme | |
| 327 | - else | |
| 328 | - @environment.theme | |
| 329 | - end | |
| 314 | + @current_theme ||= | |
| 315 | + begin | |
| 316 | + if (session[:theme]) | |
| 317 | + session[:theme] | |
| 318 | + else | |
| 319 | + # utility for developers: set the theme to 'random' in development mode and | |
| 320 | + # you will get a different theme every request. This is interesting for | |
| 321 | + # testing | |
| 322 | + if ENV['RAILS_ENV'] == 'development' && environment.theme == 'random' | |
| 323 | + @random_theme ||= Dir.glob('public/designs/themes/*').map { |f| File.basename(f) }.rand | |
| 324 | + @random_theme | |
| 325 | + else | |
| 326 | + if profile | |
| 327 | + profile.theme | |
| 328 | + elsif environment | |
| 329 | + environment.theme | |
| 330 | + else | |
| 331 | + if logger | |
| 332 | + logger.warn("No environment found. This is weird.") | |
| 333 | + logger.warn("Request environment: %s" % request.env.inspect) | |
| 334 | + logger.warn("Request parameters: %s" % params.inspect) | |
| 335 | + end | |
| 336 | + | |
| 337 | + # could not determine the theme, so return the default one | |
| 338 | + 'default' | |
| 339 | + end | |
| 340 | + end | |
| 341 | + end | |
| 342 | + end | |
| 330 | 343 | end |
| 331 | 344 | |
| 332 | 345 | def theme_include(template) | ... | ... |
db/schema.rb
| ... | ... | @@ -89,8 +89,8 @@ ActiveRecord::Schema.define(:version => 69) do |
| 89 | 89 | t.boolean "virtual", :default => false |
| 90 | 90 | end |
| 91 | 91 | |
| 92 | - add_index "articles_categories", ["article_id"], :name => "index_articles_categories_on_article_id" | |
| 93 | 92 | add_index "articles_categories", ["category_id"], :name => "index_articles_categories_on_category_id" |
| 93 | + add_index "articles_categories", ["article_id"], :name => "index_articles_categories_on_article_id" | |
| 94 | 94 | |
| 95 | 95 | create_table "blocks", :force => true do |t| |
| 96 | 96 | t.string "title" |
| ... | ... | @@ -131,8 +131,8 @@ ActiveRecord::Schema.define(:version => 69) do |
| 131 | 131 | t.boolean "virtual", :default => false |
| 132 | 132 | end |
| 133 | 133 | |
| 134 | - add_index "categories_profiles", ["profile_id"], :name => "index_categories_profiles_on_profile_id" | |
| 135 | 134 | add_index "categories_profiles", ["category_id"], :name => "index_categories_profiles_on_category_id" |
| 135 | + add_index "categories_profiles", ["profile_id"], :name => "index_categories_profiles_on_profile_id" | |
| 136 | 136 | |
| 137 | 137 | create_table "comments", :force => true do |t| |
| 138 | 138 | t.string "title" |
| ... | ... | @@ -211,8 +211,8 @@ ActiveRecord::Schema.define(:version => 69) do |
| 211 | 211 | t.datetime "updated_at" |
| 212 | 212 | end |
| 213 | 213 | |
| 214 | - add_index "product_categorizations", ["product_id"], :name => "index_product_categorizations_on_product_id" | |
| 215 | 214 | add_index "product_categorizations", ["category_id"], :name => "index_product_categorizations_on_category_id" |
| 215 | + add_index "product_categorizations", ["product_id"], :name => "index_product_categorizations_on_product_id" | |
| 216 | 216 | |
| 217 | 217 | create_table "products", :force => true do |t| |
| 218 | 218 | t.integer "enterprise_id" |
| ... | ... | @@ -284,10 +284,6 @@ ActiveRecord::Schema.define(:version => 69) do |
| 284 | 284 | t.integer "environment_id" |
| 285 | 285 | end |
| 286 | 286 | |
| 287 | - create_table "schema_info", :id => false, :force => true do |t| | |
| 288 | - t.integer "version" | |
| 289 | - end | |
| 290 | - | |
| 291 | 287 | create_table "taggings", :force => true do |t| |
| 292 | 288 | t.integer "tag_id" |
| 293 | 289 | t.integer "taggable_id" |
| ... | ... | @@ -295,8 +291,8 @@ ActiveRecord::Schema.define(:version => 69) do |
| 295 | 291 | t.datetime "created_at" |
| 296 | 292 | end |
| 297 | 293 | |
| 298 | - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" | |
| 299 | 294 | add_index "taggings", ["taggable_id", "taggable_type"], :name => "index_taggings_on_taggable_id_and_taggable_type" |
| 295 | + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" | |
| 300 | 296 | |
| 301 | 297 | create_table "tags", :force => true do |t| |
| 302 | 298 | t.string "name" | ... | ... |