app/controllers/costumes_controller.rb
# before_action only: %i[create assign]
# gets shared assignment info to check if assigning / validate assignments
before_action only: %i[create assign]
gets shared assignment info to check if assigning / validate assignments
before_action only : %i [ create assign ] gets shared assignment info to check if assigning / validate assignments
def fetch_shared_assignment_info
    if costume_assignments_attributes.nil?
      @assignment_info = {'dance_season'=>'', 'song_name'=>'', 'genre'=>'', 'hair_accessory'=>'', 'shoe'=>'', 'tight'=>''}
    else
      @assignment_info = costume_assignments_attributes.permit!.to_h.first.pop
      @dance_season_empty = @assignment_info[:dance_season].empty?
      @song_name_empty = @assignment_info[:song_name].empty?
    end
  end
def fetch_shared_assignment_info if costume_assignments_attributes . nil? @assignment_info = { 'dance_season' => '' , 'song_name' => '' , 'genre' => '' , 'hair_accessory' => '' , 'shoe' => '' , 'tight' => '' } else @assignment_info = costume_assignments_attributes . permit! . to_h . first . pop @dance_season_empty = @assignment_info [ :dance_season ] . empty? @song_name_empty = @assignment_info [ :song_name ] . empty? end end
before_action only: %i[create assign]
gets shared assignment info to check if assigning / validate assignments
before_action only : %i [ create assign ] gets shared assignment info to check if assigning / validate assignments
# studio doesn't have any current dancers # => {"dance_season"=>"", "song_name"=>"", "genre"=>"", "hair_accessory"=>"", "shoe"=>"", "tight"=>""}