Q:

usage of query where in controller

I want to display events of specific season and championship, but I have all the events of a championship.  Where I am not right? 
  resources :championships do 
    resources :seasons do 
      resources :events 
    end
  end

class EventsController < ApplicationController
  def index
    @events = @championship.events.where(params[:season_id] == @season.id)
  end
end

Started GET "/championships/2/seasons/2/events" for 127.0.0.1 at 2016-12-28 12:07:07 +0200
Processing by EventsController#index as HTML
  Parameters: {"championship_id"=>"2", "season_id"=>"2"}
  Championship Load (0.3ms)  SELECT  "championships".*  FROM "championships" WHERE "championships". "id" = $1 LIMIT 1  [["id", 2]]
  Season Load (0.3ms)  SELECT  "seasons".*  FROM "seasons" WHERE "seasons". "id" = $1 LIMIT 1  [["id", 2]]

A:

Here is your error:
@events = @championship.events.where(params[:season_id] == @season.id)

You give where either true or false
but you need to do this:
@events = @championship.events.where(:season_id => params[:season_id])

