Class: Platform::BaseController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/platform/base_controller.rb

Overview

– Copyright © 2011 Michael Berkovich

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++

Instance Method Summary collapse

Instance Method Details

#mobile_device?Boolean

Returns:

  • (Boolean)


75
76
77
78
79
# File 'app/controllers/platform/base_controller.rb', line 75

def mobile_device?
  return false if request.user_agent.blank?
  ua = request.user_agent.downcase
  ['iphone', 'android'].any? {|agent| ua.index(agent)}
end

#platform_current_developerObject



55
56
57
# File 'app/controllers/platform/base_controller.rb', line 55

def platform_current_developer
  Platform::Config.current_developer
end

#platform_current_userObject



50
51
52
# File 'app/controllers/platform/base_controller.rb', line 50

def platform_current_user
  Platform::Config.current_user
end

#platform_current_user_is_admin?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'app/controllers/platform/base_controller.rb', line 60

def platform_current_user_is_admin?
  Platform::Config.current_user_is_admin?
end

#platform_current_user_is_developer?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'app/controllers/platform/base_controller.rb', line 70

def platform_current_user_is_developer?
  Platform::Config.current_user_is_developer?
end

#platform_current_user_is_guest?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'app/controllers/platform/base_controller.rb', line 65

def platform_current_user_is_guest?
  Platform::Config.current_user_is_guest?
end