diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index 2516cdf..c863a32 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -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 diff --git a/config/application.rb b/config/application.rb index 440e031..6c4e407 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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 diff --git a/config/environments/development.rb b/config/environments/development.rb index 6c0915c..a35e5e9 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -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 diff --git a/config/secrets.yml b/config/secrets.yml index 84248ce..388228d 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -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: diff --git a/lib/tasks/devseeds.rake b/lib/tasks/devseeds.rake index 3d6dbf8..b26cbe4 100644 --- a/lib/tasks/devseeds.rake +++ b/lib/tasks/devseeds.rake @@ -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