title: No route matches {:action=>"show", :controller=>"waitinglists", :format=>nil, :id=>nil} missing required keys: [:id]
body: <p>I'm very new to rails.
  and got this error </p>
  
  <blockquote>
    <p>No route matches {:action=>"show", :controller=>"waitinglists",
    :format=>nil, :id=>nil} missing required keys: [:id]</p>
  </blockquote>
  
  <p>I know why because I didn"t give :id when I want to redirect , but I don"t know how to give it.</p>
  
  <p>In the index action, I"m not using any forms or link_to stuffs because I just want it to redirect automatically using auto refreshing by time proceeding.</p>
  
  <p>What I want to do is redirect from index to show action.</p>
  
  <p>please tell me how to work it.</p>
  
  <p><strong>Controllers</strong></p>
  
  <p><strong>Waitinglists_controller</strong></p>
  
  <pre><code>class WaitinglistsController &lt; ApplicationController
      before_action :authenticate
  
      def index
  
          last_group_number = Waitinglist.last.count_number 
          @already_group_people = Waitinglist.where(count_number: last_group_number).count
          @current_person_number = Waitinglist.where(owner_id: current_user.id).last.count_number 
          @current_group_people = Waitinglist.where(count_number: @current_person_number).count 
          current_person_list = current_user.created_waitinglists.last
  
  
          redirect_to waitinglists_path if @current_group_people === 4 
  
              if @already_group_people === 4 
                  current_person_list.count_number = last_group_number 
                  current_person_list.save
                  redirect_to waitinglist_path(@waitinglist, @owner) 
  
              elsif @already_group_people === 5 
                  last_group_number += 1 
                  current_person_list.count_number = last_group_number 
                  current_person_list.save 
              else
                  current_person_list.count_number = last_group_number 
                  current_person_list.save
              end
      end
  
      def new
          @waitinglist = current_user.created_waitinglists.build
      end
  
      def create
          @waitinglist = current_user.created_waitinglists.build(waitinglist_params)
          if @waitinglist.save
              redirect_to waitinglists_path(@waitinglist, @owner), notice:
          else
              render :new
          end
      end
  
      def show
  
          @matched_people = Waitinglist.find(count_number: @current_person_number)
  
      end 
  
      def destroy
          @waitnglist = current_user.created_waitinglists.find(params[:id])
          @waitinglist.destroy!
          redirect_to root_path,
      end
  
  
  
      private
  
      def created_by?(user)
          return false unless user
          owner_id == user.id
      end
  
      def waitinglist_params
          params.require(:waitinglist).permit(:look_like, :id)
      end
  end
  </code></pre>
  
  <p><strong>application_controller</strong></p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    # Prevent CSRF attacks by raising an exception.
    # For APIs, you may want to use :null_session instead.
    protect_from_forgery with: :exception
  
  
  
    helper_method :current_user, :logged_in?
  
      private
  
      def current_user
          @current_user ||= User.find(session[:user_id]) if session[:user_id]
      end
  
      def logged_in?
          !!session[:user_id]
      end
  
      def authenticate
          return if logged_in?
          redirect_to root_path, alert: 
      end
  
  end
  </code></pre>
  
  <p><strong>Sessions_controller</strong></p>
  
  <pre><code>class SessionsController &lt; ApplicationController
  
      def create
          user = User.find_or_create_from_auth_hash(request.env['omniauth.auth'])
          session[:user_id] = user.id
          redirect_to root_path,
      end
  
      def destroy
          reset_session
          redirect_to root_path, 
      end
  
  
  end
  </code></pre>
  
  <p><strong>welcome_controller</strong></p>
  
  <pre><code>class WelcomeController &lt; ApplicationController
    def index
    end
  end
  </code></pre>
  
  <p><strong>Models</strong></p>
  
  <p><strong>User.rb</strong></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
      has_many :created_waitinglists, class_name: 'Waitinglist', foreign_key: :owner_id
  
      def self.find_or_create_from_auth_hash(auth_hash)
          provider = auth_hash[:provider]
          uid = auth_hash[:uid]
          name = auth_hash[:info][:name]
          image_url = auth_hash[:info][:image]
  
          User.find_or_create_by(provider: provider, uid: uid) do |user|
              user.nickname = name
              user.image_url = image_url
          end
      end
  
      def created_by?(user)
          return false unless user
          owner_id == user.id
      end
  end
  </code></pre>
  
  <p><strong>waitinglist.rb</strong></p>
  
  <pre><code>class Waitinglist &lt; ActiveRecord::Base
      belongs_to :waiting_person, class_name: 'User'
      after_initialize :set_default_value
  
    private
    def set_default_value
      self.count_number  ||= 0
    end
  end
  </code></pre>
  
  <p><strong>Views</strong>(only related views)</p>
  
  <p><strong>index.html.erb</strong></p>
  
  <pre><code>&lt;div class="main"&gt;
  
            &lt;p&gt;&lt;%= @current_group_people %&gt;&lt;/p&gt;
  
  
  &lt;%= link_to 'cancel', new_waitinglist_path, class: 'btn btn-danger btn-lg btn-block', method: :delete, data:  %&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>show.html.erb</strong></p>
  
  <pre><code>&lt;div class="list-group"&gt;
  &lt;% @matched_people.each do |matched_people| %&gt;
  &lt;h4 class="list-group-item-heading"&gt;
  &lt;%= waiting_person.image_url %&gt;
  &lt;%= waiting_person.nickname %&gt;
  &lt;/h4&gt;
  &lt;p class="list-group-item-text"&gt;
  &lt;%= waitinglist.look_like %&gt;
  &lt;/p&gt;
  &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>