Module: Auth::Concerns::Shopping::ProductControllerConcern

Extended by:
ActiveSupport::Concern
Included in:
Shopping::ProductsController
Defined in:
app/controllers/auth/concerns/shopping/product_controller_concern.rb

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
# File 'app/controllers/auth/concerns/shopping/product_controller_concern.rb', line 19

def create
  check_for_create(@auth_shopping_product)
  @auth_shopping_product = add_owner_and_signed_in_resource(@auth_shopping_product,{:owner_is_current_resource => true})
	
  @auth_shopping_product.save
  respond_with @auth_shopping_product
  
end

#destroyObject



48
49
50
51
52
# File 'app/controllers/auth/concerns/shopping/product_controller_concern.rb', line 48

def destroy
  check_for_destroy(@auth_shopping_product)
  @auth_shopping_product.delete
  respond_with @auth_shopping_product
end

#editObject



58
59
60
# File 'app/controllers/auth/concerns/shopping/product_controller_concern.rb', line 58

def edit

end

#indexObject



37
38
39
40
# File 'app/controllers/auth/concerns/shopping/product_controller_concern.rb', line 37

def index
  instantiate_shopping_classes
  @auth_shopping_products = @auth_shopping_product_class.all
end

#initialize_varsObject



11
12
13
14
15
# File 'app/controllers/auth/concerns/shopping/product_controller_concern.rb', line 11

def initialize_vars
	instantiate_shopping_classes
  @auth_shopping_product_params = permitted_params.fetch(:product,{})
  @auth_shopping_product = params[:id] ? @auth_shopping_product_class.find_self(params[:id],current_signed_in_resource) : @auth_shopping_product_class.new(@auth_shopping_product_params)
end

#newObject



54
55
56
# File 'app/controllers/auth/concerns/shopping/product_controller_concern.rb', line 54

def new
  
end

#permitted_paramsObject



62
63
64
# File 'app/controllers/auth/concerns/shopping/product_controller_concern.rb', line 62

def permitted_params
	params.permit({:product => [:name,:price]})
end

#showObject



42
43
44
45
46
# File 'app/controllers/auth/concerns/shopping/product_controller_concern.rb', line 42

def show
  instantiate_shopping_classes
  @auth_shopping_product = @auth_shopping_product_class.find(params[:id])
  ## will render show.json.erb if its a json request.
end

#updateObject



28
29
30
31
32
33
34
35
# File 'app/controllers/auth/concerns/shopping/product_controller_concern.rb', line 28

def update
  check_for_update(@auth_shopping_product)
  @auth_shopping_product = add_owner_and_signed_in_resource(@auth_shopping_product,{:owner_is_current_resource => true})
  @auth_shopping_product.assign_attributes(@auth_shopping_product_params)
  @auth_shopping_product.save
  respond_with @auth_shopping_product
  
end