mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
When fragment caching is enabled—
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -27 +26,0 @@
- config.action_controller.perform_caching = false
@@ -29 +27,0 @@
- config.cache_store = :null_store
—the test of voting fails with:
expected to find css ".rating.bright" … 3 times but there were no matches
expected to find visible css ".rating:not(.bright)" … 2 times, found 5 matches
# ./spec/features/voting_spec.rb:31
# ./spec/features/voting_spec.rb:30
# ./spec/features/voting_spec.rb:53
i.e. the rating displayed on the event index is not updated after
voting, because while the fragment’s cache dependencies include the
event, voting doesn’t update the event.
re #2767
18 lines
355 B
Ruby
18 lines
355 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Vote < ApplicationRecord
|
|
belongs_to :user
|
|
belongs_to :event, touch: true
|
|
|
|
validates :user_id, uniqueness: { scope: :event_id }
|
|
|
|
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
|
|
|
|
delegate :name, to: :user
|
|
|
|
private
|
|
|
|
def conference_id
|
|
event.program.conference_id
|
|
end
|
|
end
|