This answer will be a little incomplete for you. I am weak with rubies on rails, but I have to help you in the DB section.
You have two tables: Area, which contains the polygon, and an event, which contains the event as one point (this is a bit more complicated if the event is also an area, and you are trying to select an overlapping area ... if the events are single points, this works) .
Select * from area a inner join event e on 1=1
This will create a list of all areas attached to each event ... if you have 500 events and 20 areas, the query will return 10'000 rows. Now you want to filter this out only for events that are in the area to which they were attached. We can use st_contains for this as st_contains (polygon, point):
where st_contains(a.polygon,e.point) = 't'
If you run this, it should give you., E. for all events within the area. Now it's just a matter of counting what you want to count.
select a.id, count(1) from area a inner join event e on 1=1 where st_contains(a.polygon,e.point) = 't' group by 1
This will give you a list of your entire area (by id) and the number of events in it. Turning off a.id with e.id will give a list of event IDs and the numbering area in which they are located.
Unfortunately, I have no idea how to express these queries in Ruby, but the database concepts you will need are here ...
For speed reasons, you should study the GIStree indexing that Postgres has ... indexed polygons perform exponentially better.
Edit:
PostGIS is a Contrib file that comes with Postgres but does not exist in a standard installation ... you need to find this Contrib file. They will install a number of GIS functions in your database, including ST_Contains. (the functions are in the database, so make sure you install the functions in the database you are using)
The second thing that files to create PostGIS install is the template_postGIS database, which is required for geometry data types (geometry as a data type will not exist until it is installed).