I'm trying the following:
Event.where('ST_Contains(?,ST_SetSRID(location, 4326)::geography)', search_polygon::geography)
add getting the error
*** NoMethodError Exception: undefined method `geography' for
but without that (::geography) I get a message telling me to cast, what do I do?
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
It looks like you are trying to use ST_Contains on geography types, but that function only works on geometry types.
If you are OK with the intersects spatial relation (see DE-9IM), then use ST_Intersects(geography, geography).