From 5348c8fa7d5bc515990b3015de83c134c060048c Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Thu, 11 Apr 2013 12:58:27 +0100 Subject: [PATCH] Rename feeds_layers table to subscriptions --- app/models/post.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index 87661bd..54dde3f 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -23,6 +23,7 @@ class Post < ActiveRecord::Base p.lat, p.lon, p.published, + p.feed_id, f.title as feed_title, ( #{EARTH_RADIUS_METRES} * acos( cos( radians('#{lat}') ) @@ -42,15 +43,15 @@ class Post < ActiveRecord::Base ( -- Subquery returns a list of post_ids for posts on this layer SELECT p.id - FROM feeds_layers fl + FROM subscriptions s INNER JOIN feeds f - ON fl.feed_id = f.id + ON s.feed_id = f.id INNER JOIN posts p ON p.feed_id = f.id - WHERE fl.layer_id = #{layer_id} + WHERE s.layer_id = #{layer_id} ) AND