diff --git a/app/models/weight.rb b/app/models/weight.rb index af41ced..cf133f5 100644 --- a/app/models/weight.rb +++ b/app/models/weight.rb @@ -2,7 +2,7 @@ class Weight < ActiveRecord::Base belongs_to :tournament has_many :wrestlers, dependent: :destroy - attr_accessor :pools + attr_accessor :pools, :bracket_size def generatePool @wrestlers = Wrestler.where(weight_id: self.id) @@ -29,5 +29,10 @@ class Weight < ActiveRecord::Base end end + def bracket_size + @wrestlers = Wrestler.where(weight_id: self.id) + return @wrestlers.size + end + end diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index 5c23ede..e9b73e0 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -69,6 +69,7 @@ Weight Class + Bracket Size @@ -77,6 +78,7 @@ <% @weights.each do |weight| %> <%= weight.max %> + <%= weight.bracket_size %> <%= link_to 'Show', weight, :class=>"btn" %> <% if user_signed_in? %> <%= link_to 'Edit', edit_weight_path(weight), :class=>"btn" %>