Changing SQL queries from active record, fighting with results showing up on main page, beginning to make SQL query dynamic