Setting variables via database query in a Rails controller
I want an admin to be able to view a list of Rides on his dash page, admin_dash#index (which iterates through each variable in a table in the typical fashion).
This is the controller for the admin dash:
class AdminDashController < ApplicationController def index @pending_rides = Ride.find_by_completed(false) @completed_rides = Ride.find_by_completed(true) end end
In rails console, these exact searches return the right results. But in the view, both of these variables appear to be nil (not even an empty array). What am I doing wrong?
try using Ride.find_all_by_completed(bool)