Class: ActiveAdmin::Dependency::Adapter::Rails

Inherits:
Base
  • Object
show all
Defined in:
lib/active_admin/dependency.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ActiveAdmin::Dependency::Adapter::Base

Instance Method Details

#parameterize(string) ⇒ Object


141
142
143
144
145
146
147
# File 'lib/active_admin/dependency.rb', line 141

def parameterize(string)
  if Dependency.rails5?
    string.parameterize separator: '_'
  else
    string.parameterize '_'
  end
end

#redirect_back(controller, fallback_location) ⇒ Object


149
150
151
152
153
154
155
156
157
158
159
# File 'lib/active_admin/dependency.rb', line 149

def redirect_back(controller, fallback_location)
  controller.instance_exec do
    if Dependency.rails5?
      redirect_back fallback_location: fallback_location
    elsif controller.request.headers.key? 'HTTP_REFERER'
      redirect_to :back
    else
      redirect_to fallback_location
    end
  end
end

#render_keyObject


161
162
163
# File 'lib/active_admin/dependency.rb', line 161

def render_key
  Dependency.rails5? ? :body : :text
end

#strong_parameters?Boolean

Returns:

  • (Boolean)

137
138
139
# File 'lib/active_admin/dependency.rb', line 137

def strong_parameters?
  @version >= 4 || defined?(ActionController::StrongParameters)
end