I want to get all the microposts where 'something' = true.
This code works fine
class UsersController < ApplicationController
.
.
.
def show
@user = User.find(params[:id])
@microposts = @user.microposts
@titre = @user.nom
end
end
But when I tried to make a where sql method this code doesn't work.
class UsersController < ApplicationController
.
.
.
def show
@user = User.find(params[:id])
@microposts = @user.microposts.where("something = 'true'")
@titre = @user.nom
end
end
any idea ?