Module: Optimizable::OptimizationsHelper

Defined in:
app/helpers/optimizable/optimizations_helper.rb

Instance Method Summary collapse

Instance Method Details

#optimization(object, option) ⇒ Object



12
13
14
15
16
17
# File 'app/helpers/optimizable/optimizations_helper.rb', line 12

def optimization(object, option)
  return nil if object.blank? || option.blank?
  o = Optimization.for(object)
  return nil unless o
  o.get(option)
end

#optimization_path_for(object) ⇒ Object



3
4
5
6
7
8
9
10
# File 'app/helpers/optimizable/optimizations_helper.rb', line 3

def optimization_path_for(object)
  o = Optimization.for(object)
  if o
    edit_optimization_path(o)
  else
    new_optimization_path(:optimizable_type => object.class.to_s.underscore, :optimizable_id => object.id)
  end
end