Class: ShopPackages::Tags::Helpers

Inherits:
Object
  • Object
show all
Extended by:
ActionView::Helpers::NumberHelper
Defined in:
lib/shop_packages/tags/helpers.rb

Class Method Summary collapse

Class Method Details

.current_package(tag) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/shop_packages/tags/helpers.rb', line 24

def current_package(tag)
  result = nil
  
  if tag.locals.shop_package.present?
    result = tag.locals.shop_package
  
  elsif tag.attr['key'] and tag.attr['value']
    result = ShopPackage.first(:conditions => { tag.attr['key'].downcase.to_sym => tag.attr['value']})
    
  end
  
  result
end

.current_packages(tag) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/shop_packages/tags/helpers.rb', line 7

def current_packages(tag)
  result = nil
  
  if tag.locals.shop_product.present?
    result = tag.locals.shop_product.packages
  
  elsif tag.attr['key'] and tag.attr['value']
    result = ShopPackage.all(:conditions => { tag.attr['key'].downcase.to_sym => tag.attr['value']})
  
  else
    result = ShopPackage.all
  
  end
  
  result
end