diff --git a/Gemfile.lock b/Gemfile.lock index 0de4dd1..2d8a94a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -143,7 +143,7 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.2.2) + loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.0) @@ -159,7 +159,7 @@ GEM multi_json (1.13.1) multipart-post (2.0.0) nio4r (2.3.1) - nokogiri (1.8.4) + nokogiri (1.8.5) mini_portile2 (~> 2.3.0) orm_adapter (0.5.0) pg (1.1.3) diff --git a/app/controllers/referrals_controller.rb b/app/controllers/referrals_controller.rb index e0b8fb4..cad1353 100644 --- a/app/controllers/referrals_controller.rb +++ b/app/controllers/referrals_controller.rb @@ -5,7 +5,7 @@ class ReferralsController < ApplicationController def new if @partner - @referrals = @partner.referrals.by_month(Time.zone.now.month) + @referrals = @partner.referrals.by_month(@date.month) @used_referrals = @referrals.used @total_available = @partner.max_monthly_referrals - @used_referrals.size else diff --git a/app/models/partner.rb b/app/models/partner.rb index aea986e..95aba06 100644 --- a/app/models/partner.rb +++ b/app/models/partner.rb @@ -1,5 +1,5 @@ class Partner < ApplicationRecord - has_many :referrals + has_many :referrals, dependent: :destroy has_secure_token :webhook_token diff --git a/app/models/referral.rb b/app/models/referral.rb index 41541dd..c8dcc63 100644 --- a/app/models/referral.rb +++ b/app/models/referral.rb @@ -4,7 +4,7 @@ class Referral < ApplicationRecord belongs_to :partner acts_as_sequenced scope: :partner_id - has_many :reviews + has_many :reviews, dependent: :destroy validates :last_state, inclusion: { in: STATES } validates :original_response, presence: true diff --git a/app/views/layouts/_month_picker.html.erb b/app/views/layouts/_month_picker.html.erb index 80456c4..4a042da 100644 --- a/app/views/layouts/_month_picker.html.erb +++ b/app/views/layouts/_month_picker.html.erb @@ -7,5 +7,5 @@ <%= "#{Date::MONTHNAMES[date.month]} #{Time.zone.now.year}" %> - <%= link_to('❯', send(path, date: date - 1.month), class: 'yellow no-decoration') %> + <%= link_to('❯', send(path, date: date - 1.month), class: 'yellow no-decoration', data: { turbolinks: false }) %> diff --git a/app/views/referrals/new.html.erb b/app/views/referrals/new.html.erb index f2e8a85..ec28bbc 100644 --- a/app/views/referrals/new.html.erb +++ b/app/views/referrals/new.html.erb @@ -29,37 +29,43 @@