Module: RPlatform::Rails

Defined in:
lib/rplatform_rails/status_manager.rb,
lib/rplatform_rails/view_extensions.rb,
lib/rplatform_rails/model_extensions.rb,
lib/rplatform_rails/controller_extensions.rb,
lib/rplatform-rails.rb

Defined Under Namespace

Modules: ControllerExtensions, ModelExtensions, SessionExtensions, SessionStoreExtensions, ViewExtensions Classes: APIKeyStatusCheck, APISecretStatusCheck, CallbackPathStatusCheck, CanvasPathStatusCheck, FacebookParamsStatusCheck, FinishFacebookLoginStatusCheck, InCanvasStatusCheck, InFrameStatusCheck, SessionStatusCheck, StatusCheck, StatusManager

Constant Summary collapse

VERSION =
'0.0.3'

Class Method Summary collapse

Class Method Details

.fix_path(path) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rplatform-rails.rb', line 22

def self.fix_path(path)
  # check to ensure that the path is relative
  if matchData = /(\w+)(\:\/\/)([\w0-9\.]+)([\:0-9]*)(.*)/.match(path)
    relativePath = matchData.captures[4]
    RAILS_DEFAULT_LOGGER.info "** RFACEBOOK INFO: It looks like you used a full URL '#{path}' in facebook.yml.  RFacebook expected a relative path and has automatically converted this URL to '#{relativePath}'."
    path = relativePath
  end

  # check for the proper leading/trailing slashes
  if (path and path.size>0)
    # force leading slash, then trailing slash
    path = "/#{path}" unless path.starts_with?("/")
    path = "#{path}/" unless path.reverse.starts_with?("/")
  end

  return path
end