Sha256: 6eee10823aa789a7a463c07b158a5b4845ca8974f3cfb84517c95aff67da5fc4

Contents?: true

Size: 785 Bytes

Versions: 3

Compression:

Stored size: 785 Bytes

Contents

# -*- coding: utf-8 -*-
class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  helper_method :standalone?

  private

  # スタンドアローンモードかどうかを返す
  def standalone?
    return false if Rails.env == 'production'
    return true if Rails.env == 'standalone'

    if Rails.env != 'test' &&
        (ENV['SMALRUBY_EDITOR_STANDALONE_MODE'] ||
         File.exist?(Rails.root.join('tmp', 'standalone')))
      true
    else
      false
    end
  end

  def check_whether_standalone
    unless standalone?
      fail "#{self.class.name}##{action_name}はstandaloneモードのみの機能です"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smalruby-editor-0.1.12-x86-mingw32 app/controllers/application_controller.rb
smalruby-editor-0.1.12 app/controllers/application_controller.rb
smalruby-editor-0.1.11-x86-mingw32 app/controllers/application_controller.rb