Class: Platform::Config

Inherits:
Object show all
Defined in:
lib/platform/config.rb

Class Method Summary collapse

Class Method Details

.admin_helpersObject



317
318
319
320
# File 'lib/platform/config.rb', line 317

def self.admin_helpers
  return [] unless site_info[:admin_helpers]
  @admin_helpers ||= site_info[:admin_helpers].collect{|helper| helper.to_sym}
end

.admin_layoutObject



284
285
286
# File 'lib/platform/config.rb', line 284

def self.admin_layout
  site_info[:admin_layout]
end

.admin_user?(user = current_user) ⇒ Boolean

Returns:

  • (Boolean)


429
430
431
432
433
434
# File 'lib/platform/config.rb', line 429

def self.admin_user?(user = current_user)
  user.send([:methods][:admin])
rescue Exception => ex
  Platform::Logger.error("Failed to fetch #{user_class_name} admin flag: #{ex.to_s}")
  false
end

.after_filtersObject



332
333
334
335
# File 'lib/platform/config.rb', line 332

def self.after_filters
  return [] unless site_info[:after_filters]
  @after_filters ||= site_info[:after_filters].collect{|filter| filter.to_sym}
end

.apiObject



225
226
227
# File 'lib/platform/config.rb', line 225

def self.api
  config[:API]
end

.api_allow_public?Boolean

Returns:

  • (Boolean)


561
562
563
# File 'lib/platform/config.rb', line 561

def self.api_allow_public?
  api[:allow_public]
end

.api_base_urlObject



581
582
583
# File 'lib/platform/config.rb', line 581

def self.api_base_url
  api[:base_url]
end

.api_config_pathObject



545
546
547
# File 'lib/platform/config.rb', line 545

def self.api_config_path
  api[:config_path]
end

.api_cookies_enabled?Boolean

Returns:

  • (Boolean)


557
558
559
# File 'lib/platform/config.rb', line 557

def self.api_cookies_enabled?
  api[:cookies_enabled]
end

.api_default_versionObject



597
598
599
# File 'lib/platform/config.rb', line 597

def self.api_default_version
  api[:default_version]
end

.api_explorer_app?Boolean

Returns:

  • (Boolean)


605
606
607
# File 'lib/platform/config.rb', line 605

def self.api_explorer_app?
  !api_explorer_app_id.blank?
end

.api_explorer_app_idObject



601
602
603
# File 'lib/platform/config.rb', line 601

def self.api_explorer_app_id
  config[:api_explorer_app_id]
end

.api_explorer_groups(api_version = api_default_version) ⇒ Object



643
644
645
# File 'lib/platform/config.rb', line 643

def self.api_explorer_groups(api_version = api_default_version)
  api[:explorer_groups][api_version]
end

.api_logging_enabled?Boolean

Returns:

  • (Boolean)


549
550
551
# File 'lib/platform/config.rb', line 549

def self.api_logging_enabled?
  api[:logging_enabled]
end

.api_max_modelsObject



565
566
567
# File 'lib/platform/config.rb', line 565

def self.api_max_models
  api[:max_models]
end

.api_reference(api_version = api_default_version) ⇒ Object

API References



627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
# File 'lib/platform/config.rb', line 627

def self.api_reference(api_version = api_default_version)
  @api_reference ||= begin
    ref = HashWithIndifferentAccess.new
    api_supported_versions.each do |version|
      ref[version] = {}
      path = "#{root}/#{api[:config_path]}/#{version}"
      files = Dir.glob("#{path}/*.yml")
      files.each do |file|
        ref[version].merge!(YAML.load_file(file))
      end
    end  
    ref.freeze
  end
  @api_reference[api_version]
end

.api_request_limitObject



553
554
555
# File 'lib/platform/config.rb', line 553

def self.api_request_limit
  api[:request_limit]
end

.api_request_windowObject



569
570
571
# File 'lib/platform/config.rb', line 569

def self.api_request_window
  api[:request_window]
end

.api_schemeObject



585
586
587
# File 'lib/platform/config.rb', line 585

def self.api_scheme
  api[:scheme]
end

.api_supported_version_optionsObject



593
594
595
# File 'lib/platform/config.rb', line 593

def self.api_supported_version_options
  @api_supported_version_options ||= api[:supported_versions].collect{|v| ["v #{v}", v]}
end

.api_supported_versionsObject



589
590
591
# File 'lib/platform/config.rb', line 589

def self.api_supported_versions
  api[:supported_versions]
end

.api_token_lifetimeObject



573
574
575
# File 'lib/platform/config.rb', line 573

def self.api_token_lifetime
  api[:token_lifetime]
end

.before_filtersObject



327
328
329
330
# File 'lib/platform/config.rb', line 327

def self.before_filters
  return [] unless site_info[:before_filters]
  @before_filters ||= site_info[:before_filters].collect{|filter| filter.to_sym}
end

.cache_adapterObject



237
238
239
# File 'lib/platform/config.rb', line 237

def self.cache_adapter
  caching[:adapter]
end

.cache_storeObject



241
242
243
# File 'lib/platform/config.rb', line 241

def self.cache_store
  caching[:store]
end

.cache_versionObject



245
246
247
# File 'lib/platform/config.rb', line 245

def self.cache_version
  caching[:version]
end

.cachingObject

Config Sections



213
214
215
# File 'lib/platform/config.rb', line 213

def self.caching
  config[:caching]
end

.configObject



166
167
168
# File 'lib/platform/config.rb', line 166

def self.config
  @config ||= load_yml("/config/platform/config.yml")
end

.create_media(file) ⇒ Object



474
475
476
477
478
479
480
481
482
# File 'lib/platform/config.rb', line 474

def self.create_media(file)
  media = site_media_class.constantize.create
  media.send(site_media_write_method, file)
  media
rescue Exception => ex
  pp ex
  Platform::Logger.error("Failed to create media: #{ex.to_s}")
  nil
end

.current_applicationObject



41
42
43
# File 'lib/platform/config.rb', line 41

def self.current_application
  Thread.current[:platform_current_application]
end

.current_application=(app) ⇒ Object



45
46
47
# File 'lib/platform/config.rb', line 45

def self.current_application=(app)
  Thread.current[:platform_current_application] = app
end

.current_developerObject



37
38
39
# File 'lib/platform/config.rb', line 37

def self.current_developer
  Thread.current[:platform_current_developer] 
end

.current_userObject



33
34
35
# File 'lib/platform/config.rb', line 33

def self.current_user
  Thread.current[:platform_current_user]
end

.current_user_is_admin?Boolean

Returns:

  • (Boolean)


436
437
438
# File 'lib/platform/config.rb', line 436

def self.current_user_is_admin?
  admin_user?
end

.current_user_is_developer?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/platform/config.rb', line 49

def self.current_user_is_developer?
  Thread.current[:platform_current_developer] != nil
end

.current_user_is_guest?Boolean

Returns:

  • (Boolean)


448
449
450
# File 'lib/platform/config.rb', line 448

def self.current_user_is_guest?
  guest_user?
end

.current_user_methodObject



345
346
347
# File 'lib/platform/config.rb', line 345

def self.current_user_method
  [:current_user_method]
end

.default_app_iconObject



202
203
204
# File 'lib/platform/config.rb', line 202

def self.default_app_icon
  "/assets/platform/default_app_icon.gif"
end

.default_app_logoObject



206
207
208
# File 'lib/platform/config.rb', line 206

def self.
  "/assets/platform/default_app_logo.gif"
end

.default_applicationsObject



144
145
146
# File 'lib/platform/config.rb', line 144

def self.default_applications
  @default_applications ||= load_yml("/config/platform/data/default_applications.yml")
end

.default_categoriesObject



148
149
150
# File 'lib/platform/config.rb', line 148

def self.default_categories
  @default_categories ||= load_yml("/config/platform/data/default_categories.yml")
end

.default_urlObject



276
277
278
# File 'lib/platform/config.rb', line 276

def self.default_url
  site_info[:default_url]
end

.disabled?Boolean

Returns:

  • (Boolean)


174
175
176
# File 'lib/platform/config.rb', line 174

def self.disabled?
  not enabled?
end

.enable_api?Boolean

API

Returns:

  • (Boolean)


541
542
543
# File 'lib/platform/config.rb', line 541

def self.enable_api?
  api[:enabled]
end

.enable_api_verification?Boolean

Returns:

  • (Boolean)


198
199
200
# File 'lib/platform/config.rb', line 198

def self.enable_api_verification?
  config[:enable_api_verification]
end

.enable_app_directory?Boolean

Returns:

  • (Boolean)


178
179
180
# File 'lib/platform/config.rb', line 178

def self.enable_app_directory?
  config[:enable_app_directory]
end

.enable_app_statistics?Boolean

Returns:

  • (Boolean)


194
195
196
# File 'lib/platform/config.rb', line 194

def self.enable_app_statistics?
  config[:enable_app_statistics]
end

.enable_caching?Boolean

Caching

Returns:

  • (Boolean)


233
234
235
# File 'lib/platform/config.rb', line 233

def self.enable_caching?
  caching[:enabled]
end

.enable_developer_agreement?Boolean

Returns:

  • (Boolean)


190
191
192
# File 'lib/platform/config.rb', line 190

def self.enable_developer_agreement?
  config[:enable_developer_agreement]
end

.enable_embedded_applications?Boolean

Returns:

  • (Boolean)


182
183
184
# File 'lib/platform/config.rb', line 182

def self.enable_embedded_applications?
  config[:enable_embedded_applications]
end

.enable_logger?Boolean

Logger

Returns:

  • (Boolean)


253
254
255
# File 'lib/platform/config.rb', line 253

def self.enable_logger?
  logger[:enabled]
end

.enable_mobile_applications?Boolean

Returns:

  • (Boolean)


186
187
188
# File 'lib/platform/config.rb', line 186

def self.enable_mobile_applications?
  config[:enable_mobile_applications]
end

.enabled?Boolean

Returns:

  • (Boolean)


170
171
172
# File 'lib/platform/config.rb', line 170

def self.enabled?
  config[:enable_platform] 
end

.envObject



156
157
158
# File 'lib/platform/config.rb', line 156

def self.env
  Rails.env
end

Application Directory

Returns:

  • (Boolean)


502
503
504
# File 'lib/platform/config.rb', line 502

def self.featured_apps_enabled?
  true
end


514
515
516
# File 'lib/platform/config.rb', line 514

def self.featured_apps_per_page
  2
end


510
511
512
# File 'lib/platform/config.rb', line 510

def self.featured_apps_per_row
  2
end


506
507
508
# File 'lib/platform/config.rb', line 506

def self.featured_apps_title
  "Featured Applications"
end

.featuresObject



653
654
655
656
657
658
659
660
661
662
663
# File 'lib/platform/config.rb', line 653

def self.features
  @features ||= begin
    defs = load_yml("/config/platform/site/features.yml")
    feats = []
    defs[:enabled_features].each do |key|
      defs[key][:key] = key
      feats << defs[key] 
    end
    feats
  end
end

.guest_user?(user = current_user) ⇒ Boolean

Returns:

  • (Boolean)


440
441
442
443
444
445
446
# File 'lib/platform/config.rb', line 440

def self.guest_user?(user = current_user)
  return true unless user
  user.send([:methods][:guest])
rescue Exception => ex
  Platform::Logger.error("Failed to fetch #{user_class_name} guest flag: #{ex.to_s}")
  true
end

.helpersObject



312
313
314
315
# File 'lib/platform/config.rb', line 312

def self.helpers
  return [] unless site_info[:helpers]
  @tr8n_helpers ||= site_info[:helpers].collect{|helper| helper.to_sym}
end

.icon_url(media) ⇒ Object



491
492
493
494
495
496
# File 'lib/platform/config.rb', line 491

def self.icon_url(media)
  eval("media.#{site_media_info[:icon_url_method]}")
rescue Exception => ex
  Platform::Logger.error("Failed to fetch icon url: #{ex.to_s}")
  default_app_icon
end

.init(site_current_user, current_application = nil) ⇒ Object



27
28
29
30
31
# File 'lib/platform/config.rb', line 27

def self.init(site_current_user, current_application = nil)
  Thread.current[:platform_current_user] = site_current_user
  Thread.current[:platform_current_developer] = Platform::Developer.for(site_current_user)
  Thread.current[:platform_current_application] = current_application
end

.init_categories(parent, categories) ⇒ Object



137
138
139
140
141
142
# File 'lib/platform/config.rb', line 137

def self.init_categories(parent, categories) 
  categories.each do |keyword, info|
    cat = Platform::Category.create(:parent => parent, :keyword => keyword, :name => info[:name], :position => info[:position])
    init_categories(cat, info[:categories]) if info[:categories]
  end
end

.init_default_applicationsObject



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/platform/config.rb', line 111

def self.init_default_applications
  puts "Initializing default applications..."
  unless system_developer
    puts "Cannot initialize default application because system user id is not specified in the config."
    return
  end
  
  default_applications.each do |keyword, description|
    category_keywords = description.delete("category_keywords")
    icon_path = description.delete("icon_path")
    logo_path = description.delete("logo_path")

    app = Platform::Application.create(description.merge(:developer => system_developer))
    app.store_icon(File.new("#{root}/#{icon_path}", "r")) if icon_path 
    app.(File.new("#{root}/#{logo_path}", "r")) if logo_path 
  
    puts "Initialized #{app.name}."
    app.approve!
  end    
end

.init_default_categoriesObject



132
133
134
135
# File 'lib/platform/config.rb', line 132

def self.init_default_categories
  puts "Initializing default categories..."
  init_categories(Platform::Category.root, default_categories)
end

.load_proxiesObject



613
614
615
616
617
# File 'lib/platform/config.rb', line 613

def self.load_proxies
  Dir["#{root}/#{proxies_path}/*_proxy_*.rb"].each do |file|
    require_or_load file
  end
end

.load_yml(file_path, for_env = env) ⇒ Object



160
161
162
163
164
# File 'lib/platform/config.rb', line 160

def self.load_yml(file_path, for_env = env)
  yml = YAML.load_file("#{root}#{file_path}")
  yml = yml[for_env] unless for_env.nil?
  HashWithIndifferentAccess.new(yml)
end

.log_pathObject



257
258
259
# File 'lib/platform/config.rb', line 257

def self.log_path
  logger[:log_path]
end

.loggerObject



217
218
219
# File 'lib/platform/config.rb', line 217

def self.logger
  config[:logger]
end

.login_url(params = {}) ⇒ Object



353
354
355
# File 'lib/platform/config.rb', line 353

def self.(params = {})
  site_info[:login_url] + (site_info[:logout_url].index('?') ? ':' : '?') + params.collect{|n,v| "#{n}=#{CGI.escape(v.to_s)}"}.join('&') 
end

.logo_url(media) ⇒ Object



484
485
486
487
488
489
# File 'lib/platform/config.rb', line 484

def self.logo_url(media)
  eval("media.#{site_media_info[:logo_url_method]}")
rescue Exception => ex
  Platform::Logger.error("Failed to fetch logo url: #{ex.to_s}")
  
end

.logout_methodObject



349
350
351
# File 'lib/platform/config.rb', line 349

def self.logout_method
  [:logout_method]
end

.logout_url(params = {}) ⇒ Object



357
358
359
# File 'lib/platform/config.rb', line 357

def self.logout_url(params = {})
  site_info[:logout_url] + (site_info[:logout_url].index('?') ? ':' : '?') + params.collect{|n,v| "#{n}=#{CGI.escape(v.to_s)}"}.join('&') 
end

.media_directoryObject



304
305
306
# File 'lib/platform/config.rb', line 304

def self.media_directory
  site_info[:media_directory]
end

.media_pathObject



308
309
310
# File 'lib/platform/config.rb', line 308

def self.media_path
  "#{root}/public#{media_directory}"
end

.modelsObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/platform/config.rb', line 59

def self.models
  @models ||= begin 
    mdls = [
        Platform::ApplicationDeveloper, Platform::ApplicationPermission, Platform::ApplicationUser,
        Platform::ApplicationCategory, Platform::Category, 
        Platform::ForumMessage, Platform::ForumTopic,
        Platform::Permission, Platform::Rating,
        Platform::Developer, Platform::Application, 
        Platform::Oauth::OauthToken, Platform::Oauth::AccessToken, 
        Platform::Oauth::RequestToken, Platform::Oauth::RefreshToken,
        Platform::Media::Media, Platform::Media::Image,
        Platform::ApplicationLog, Platform::RollupLog, 
        Platform::ApplicationMetric, Platform::DailyApplicationMetric, 
        Platform::WeeklyApplicationMetric, Platform::MonthlyApplicationMetric, 
        Platform::TotalApplicationMetric, Platform::ApplicationUsageMetric,
        Platform::LoggedException
    ]
  
    if user_class_name == "Platform::PlatformUser" # used for stand-alone deployment only
      mdls << [Platform::PlatformUser, Platform::PlatformAdmin] 
    end  
  
    mdls.flatten
  end
end

.oauth_desktop_layoutObject



300
301
302
# File 'lib/platform/config.rb', line 300

def self.oauth_desktop_layout
  site_info[:oauth_desktop_layout]
end

.oauth_mobile_layoutObject



296
297
298
# File 'lib/platform/config.rb', line 296

def self.oauth_mobile_layout
  site_info[:oauth_mobile_layout]
end

.oauth_popup_layoutObject



292
293
294
# File 'lib/platform/config.rb', line 292

def self.oauth_popup_layout
  site_info[:oauth_popup_layout]
end

.oauth_web_layoutObject



288
289
290
# File 'lib/platform/config.rb', line 288

def self.oauth_web_layout
  site_info[:oauth_web_layout]
end

.proxiesObject



619
620
621
# File 'lib/platform/config.rb', line 619

def self.proxies
  @proxies ||= {}
end

.proxies_pathObject



609
610
611
# File 'lib/platform/config.rb', line 609

def self.proxies_path
  api[:proxies_path]
end

.reset!Object



53
54
55
56
57
# File 'lib/platform/config.rb', line 53

def self.reset!
  Thread.current[:platform_current_user] = nil
  Thread.current[:platform_current_developer] = nil
  Thread.current[:platform_current_application] = nil
end

.reset_all!Object



85
86
87
88
89
90
91
92
93
94
95
# File 'lib/platform/config.rb', line 85

def self.reset_all!
  models.each do |cls|
    puts ">> Resetting #{cls.name}..."
    cls.delete_all
  end

  init_default_categories
  init_default_applications

  puts "Done."
end

.rootObject



152
153
154
# File 'lib/platform/config.rb', line 152

def self.root
  Rails.root
end

.searched_apps_per_pageObject



534
535
536
# File 'lib/platform/config.rb', line 534

def self.searched_apps_per_page
  15
end

.searched_apps_titleObject



530
531
532
# File 'lib/platform/config.rb', line 530

def self.searched_apps_title
  "Search Results"
end

.silhouette_image(user = current_user) ⇒ Object



649
650
651
# File 'lib/platform/config.rb', line 649

def self.silhouette_image(user = current_user)
  "/assets/platform/photo_silhouette.gif"
end

.site_base_urlObject



272
273
274
# File 'lib/platform/config.rb', line 272

def self.site_base_url
  site_info[:base_url]
end

.site_infoObject



221
222
223
# File 'lib/platform/config.rb', line 221

def self.site_info
  config[:site_info]
end

.site_layoutObject



280
281
282
# File 'lib/platform/config.rb', line 280

def self.site_layout
  site_info[:platform_layout]
end

.site_logo_urlObject



268
269
270
# File 'lib/platform/config.rb', line 268

def self.site_logo_url
  site_info[:logo_url] 
end

.site_media_classObject



465
466
467
468
# File 'lib/platform/config.rb', line 465

def self.site_media_class
  return "Platform::Media::Image" unless site_media_enabled?
  site_media_info[:class_name]
end

.site_media_enabled?Boolean

Returns:

  • (Boolean)


461
462
463
# File 'lib/platform/config.rb', line 461

def self.site_media_enabled?
  site_media_info[:enabled]
end

.site_media_infoObject

site media info The following methods could be overloaded in the initializer



457
458
459
# File 'lib/platform/config.rb', line 457

def self.site_media_info
  site_info[:media_info]
end

.site_media_write_methodObject



470
471
472
# File 'lib/platform/config.rb', line 470

def self.site_media_write_method
  site_media_info[:write_method]
end

.site_titleObject

Site Info



264
265
266
# File 'lib/platform/config.rb', line 264

def self.site_title
  site_info[:title] 
end

.site_user_infoObject

site user info The following methods could be overloaded in the initializer



341
342
343
# File 'lib/platform/config.rb', line 341

def self.
  site_info[:user_info]
end

.site_user_info_disabled?Boolean

Returns:

  • (Boolean)


365
366
367
# File 'lib/platform/config.rb', line 365

def self.
  !
end

.site_user_info_enabled?Boolean

Returns:

  • (Boolean)


361
362
363
# File 'lib/platform/config.rb', line 361

def self.
  [:enabled].nil? ? true : [:enabled]
end

.skip_before_filtersObject



322
323
324
325
# File 'lib/platform/config.rb', line 322

def self.skip_before_filters
  return [] unless site_info[:skip_before_filters]
  @skip_before_filters ||= site_info[:skip_before_filters].collect{|filter| filter.to_sym}
end

.suggested_apps_per_pageObject



526
527
528
# File 'lib/platform/config.rb', line 526

def self.suggested_apps_per_page
  20
end

.suggested_apps_per_rowObject



522
523
524
# File 'lib/platform/config.rb', line 522

def self.suggested_apps_per_row
  5
end

.suggested_apps_titleObject



518
519
520
# File 'lib/platform/config.rb', line 518

def self.suggested_apps_title
  "Applications You May Like"
end

.system_developerObject



107
108
109
# File 'lib/platform/config.rb', line 107

def self.system_developer
  @system_developer ||= Platform::Developer.find_or_create(Platform::Config.system_user)
end

.system_userObject



97
98
99
100
101
102
103
104
105
# File 'lib/platform/config.rb', line 97

def self.system_user
  if user_class_name == "Platform::PlatformUser"
    @system_user ||= Platform::PlatformUser.first || Platform::PlatformUser.create(:name => "System User")
    return @system_user
  end

  return nil unless site_info[:system_user_id]
  @system_user ||= user_class_name.constantize.find_by_id(site_info[:system_user_id])
end

.user_classObject



374
375
376
# File 'lib/platform/config.rb', line 374

def self.user_class
  user_class_name.constantize
end

.user_class_nameObject



369
370
371
372
# File 'lib/platform/config.rb', line 369

def self.user_class_name
  return [:class_name] if 
  "Platform::PlatformUser"  
end

.user_email(user = current_user) ⇒ Object



392
393
394
395
396
397
# File 'lib/platform/config.rb', line 392

def self.user_email(user = current_user)
  user.send([:methods][:email])
rescue Exception => ex
  Platform::Logger.error("Failed to fetch #{user_class_name} name: #{ex.to_s}")
  nil
end

.user_gender(user = current_user) ⇒ Object



399
400
401
402
403
404
# File 'lib/platform/config.rb', line 399

def self.user_gender(user = current_user)
  user.send([:methods][:gender])
rescue Exception => ex
  Platform::Logger.error("Failed to fetch #{user_class_name} name: #{ex.to_s}")
  "unknown"
end

.user_id(user = current_user) ⇒ Object



378
379
380
381
382
383
# File 'lib/platform/config.rb', line 378

def self.user_id(user = current_user)
  user.send([:methods][:id])
rescue Exception => ex
  Platform::Logger.error("Failed to fetch user id: #{ex.to_s}")
  0
end


415
416
417
418
419
420
# File 'lib/platform/config.rb', line 415

def self.user_link(user = current_user)
  user.send([:methods][:link])
rescue Exception => ex
  Platform::Logger.error("Failed to fetch #{user_class_name} link: #{ex.to_s}")
  "/tr8n"
end

.user_locale(user = current_user) ⇒ Object



422
423
424
425
426
427
# File 'lib/platform/config.rb', line 422

def self.user_locale(user = current_user)
  user.send([:methods][:locale])
rescue Exception => ex
  Platform::Logger.error("Failed to fetch #{user_class_name} locale: #{ex.to_s}")
  default_locale
end

.user_mugshot(user = current_user) ⇒ Object



406
407
408
409
410
411
412
413
# File 'lib/platform/config.rb', line 406

def self.user_mugshot(user = current_user)
  mugshot_image = user.send([:methods][:mugshot])
  return silhouette_image(user) if mugshot_image.blank?
  mugshot_image
rescue Exception => ex
  Platform::Logger.error("Failed to fetch #{user_class_name} image: #{ex.to_s}")
  silhouette_image
end

.user_name(user = current_user) ⇒ Object



385
386
387
388
389
390
# File 'lib/platform/config.rb', line 385

def self.user_name(user = current_user)
  user.send([:methods][:name])
rescue Exception => ex
  Platform::Logger.error("Failed to fetch #{user_class_name} name: #{ex.to_s}")
  "Unknown user"
end