mirror of
https://github.com/iritmaximus/brewery.git
synced 2026-10-12 19:13:49 +03:00
fixed tests after migration
This commit is contained in:
@@ -2,6 +2,7 @@ class Beer < ApplicationRecord
|
||||
include RatingAverage
|
||||
|
||||
belongs_to :brewery
|
||||
belongs_to :style
|
||||
has_many :ratings, dependent: :destroy
|
||||
has_many :users, through: :ratings
|
||||
|
||||
|
||||
+2
-1
@@ -36,9 +36,10 @@ class User < ApplicationRecord
|
||||
|
||||
items = {}
|
||||
ratings.each do |rating|
|
||||
style = Style.find_by_id rating.beer.style_id
|
||||
attributes = {
|
||||
# create hash with key being style name and value first 0 and then the score
|
||||
"styles" => rating.beer.style,
|
||||
"styles" => style.name,
|
||||
# iterate through ratings and add scores depending on
|
||||
# which brewery the beer that was rated was made in
|
||||
"breweries" => rating.beer.brewery.name
|
||||
|
||||
Reference in New Issue
Block a user