Release users from the burden of needing to have a dagschotel

This commit is contained in:
tl3ilaxu 2016-03-02 00:43:27 +01:00
parent 7d07d12493
commit 536d4c44ae
2 changed files with 1 additions and 3 deletions

View file

@ -29,8 +29,6 @@ class User < ActiveRecord::Base
has_many :products, through: :orders
belongs_to :dagschotel, class_name: 'Product'
validates :dagschotel, presence: true, if: -> { dagschotel_id }
scope :members, -> { where koelkast: false }
scope :publik, -> { where private: false }

View file

@ -6,4 +6,4 @@
- if current_user.dagschotel != product
= button_to "Make dagschotel", { controller: 'users', action: 'update', "user[dagschotel_id]" => product.id }, method: :put, class: "btn btn-default"
- else
%span.btn.btn-success= "Current dagschotel"
= button_to "Current dagschotel", { controller: 'users', action: 'update', "user[dagschotel_id]" => "nil" }, method: :put, class: "btn btn-success"