app/controllers/products_controller.rb
# Adds product to the specified group's portfolio
Adds product to the specified group's portfolio
Adds product to the specified group ' s portfolio
def new_product_group_portfolio(new_product_group_portfolios)
      unless new_product_group_portfolios.blank?
        new_product_group_portfolios.to_a.each do |new_pg|
          new_pg = new_pg.last
          unless new_pg.blank? || new_pg["group_id"].blank?
            if @product.product_group_portfolios.new(new_pg).save
              flash[:notice] = "Group added."
            else
              flash[:error] = "Cannot add group"
              @error = true
            end
          end
        end
      end
    end
def new_product_group_portfolio ( new_product_group_portfolios ) unless new_product_group_portfolios . blank? new_product_group_portfolios . to_a . each do | new_pg | new_pg = new_pg . last unless new_pg . blank? || new_pg [ "group_id" ] . blank? if @product . product_group_portfolios . new ( new_pg ) . save flash [ :notice ] = "Group added." else flash [ :error ] = "Cannot add group" @error = true end end end end end
Adds product to the specified group's portfolio
Adds product to the specified group ' s portfolio
new_product_group_portfolios