Module: Auth::Shopping::Products::ProductsHelper

Defined in:
app/helpers/auth/shopping/products/products_helper.rb

Instance Method Summary collapse

Instance Method Details

#create_cart_item_from_product(product) ⇒ Object

@param product @return citem



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/auth/shopping/products/products_helper.rb', line 6

def create_cart_item_from_product(product)
    citem = Auth.configuration.cart_item_class.constantize.new
    product.attributes.keys.each do |p_att|
        if citem.respond_to? p_att.to_sym
            unless (p_att == "_id" || p_att == "_type" || p_att == "resource_id" || p_att == "resource_class")  
                citem.send("#{p_att}=",product.send("#{p_att}"))
            end
        end
    end
    citem.product_id = product.id.to_s
   
    citem
end

#edit_product_path(product) ⇒ Object

/shopping/products/:id/edit



48
49
50
# File 'app/helpers/auth/shopping/products/products_helper.rb', line 48

def edit_product_path(product)
	main_app.send(Auth::OmniAuth::Path.edit_path(Auth.configuration.product_class),product)
end

#new_product_pathObject

get /new



31
32
33
# File 'app/helpers/auth/shopping/products/products_helper.rb', line 31

def new_product_path
  main_app.send(Auth::OmniAuth::Path.new_path(Auth.configuration.product_class))
end

#product_path(product) ⇒ Object

(PUT/PATCH/GET) - individual product



36
37
38
39
# File 'app/helpers/auth/shopping/products/products_helper.rb', line 36

def product_path(product)
	
	main_app.send(Auth::OmniAuth::Path.show_or_update_or_delete_path(Auth.configuration.product_class),product)
end

#products_path(params = {}) ⇒ Object

/products (GET - all products /CREATE - individual product)



43
44
45
# File 'app/helpers/auth/shopping/products/products_helper.rb', line 43

def products_path(params={})
	main_app.send(Auth::OmniAuth::Path.create_or_index_path(Auth.configuration.product_class),params)
end