Little bug with user order

This commit is contained in:
benji 2016-02-02 15:20:04 +01:00
parent e396401a4a
commit 6aec736c52
5 changed files with 7 additions and 4 deletions

View file

@ -1,6 +1,7 @@
class OrdersController < ApplicationController
load_resource :user
load_and_authorize_resource :order, through: :user, shallow: true
load_and_authorize_resource :order, through: :user, shallow: true, only: [:overview, :destroy]
load_and_authorize_resource :order, through: :user, only: [:new, :create]
def new
@products = Product.all.for_sale.order(:name)
@ -8,6 +9,7 @@ class OrdersController < ApplicationController
end
def create
@order.user = @user
if @order.save
flash[:success] = @order.flash_success
redirect_to root_path

View file

@ -21,6 +21,6 @@ module Tab002
# config.i18n.default_locale = :de
config.active_record.raise_in_transactional_callbacks = true
config.active_job.queue_adapter = :delayed_job
config.call_api_after = 5.minutes
config.call_api_after = 5.seconds
end
end

View file

@ -40,4 +40,5 @@ Rails.application.configure do
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.api_url = "http://localhost:3001"
Delayed::Worker.logger = Rails.logger
end

View file

@ -15,7 +15,7 @@ development:
omniauth_client_id: tomtest
omniauth_client_secret: blargh
access_token: "token"
tab_api_key: "HriaktSIhRaB5CJzD71uLQ=="
tab_api_key: "o6UIYc0r0cvsy0Ohaohqsw=="
koelkast_token: "token"
test:

View file

@ -2,7 +2,7 @@ unless Rails.env.production?
require 'factory_girl'
require 'faker'
task :sow => :environment do
FactoryGirl.create_list(:user, 20)
# FactoryGirl.create_list(:user, 20)
FactoryGirl.create_list(:product, 20)
end
end