You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling popular_tags on a model class works flawless, but it seems not possible to call it on a relation or scope.
My model is called business and has (rocket)tags. If I do something like
@businesses = Business.near(lat,lng)
And then call
@businesses.popular_tags
to get the tag_cloud for this subset of entities, i get the following exception:
PGError: ERROR: subquery has too many columns
LINE 1: ...e_type" = 'Business' AND "taggings"."taggable_id" IN (SELECT...
^
: SELECT COUNT(*) FROM (SELECT count("tags"."id") AS tags_count, tags.* FROM "tags" INNER JOIN "taggings" ON "taggings"."tag_id" = "tags"."id" WHERE "taggings"."taggable_type" = 'Business' AND "taggings"."taggable_id" IN (SELECT businesses.*, 6371.0 * 2 * ASIN(SQRT(POWER(SIN((52.5408134 - businesses.latitude) * PI() / 180 / 2), 2) + COS(52.5408134 * PI() / 180) * COS(businesses.latitude * PI() / 180) * POWER(SIN((13.4155842 - businesses.longitude) * PI() / 180 / 2), 2) )) AS distance, CAST(DEGREES(ATAN2( RADIANS(businesses.longitude - 13.4155842), RADIANS(businesses.latitude - 52.5408134))) + 360 AS decimal) % 360 AS bearing, "businesses"."id" FROM "businesses" WHERE (6371.0 * 2 * ASIN(SQRT(POWER(SIN((52.5408134 - businesses.latitude) * PI() / 180 / 2), 2) + COS(52.5408134 * PI() / 180) * COS(businesses.latitude * PI() / 180) * POWER(SIN((13.4155842 - businesses.longitude) * PI() / 180 / 2), 2) )) <= 50) ORDER BY distance LIMIT 9 OFFSET 0) GROUP BY "tags"."id", "tags"."name" ORDER BY tags_count desc) tags
The SQL is not correct, because a IN may not have more than one selected attribute. I don't know though how to rewrite the query correctly in the mind of rocket_tag. Any idea? Is this a error at all or am I using rocket_tags incorrectly. There has to be a way to achieve tag_cloud for subsets.
The text was updated successfully, but these errors were encountered:
Calling popular_tags on a model class works flawless, but it seems not possible to call it on a relation or scope.
My model is called business and has (rocket)tags. If I do something like
And then call
to get the tag_cloud for this subset of entities, i get the following exception:
The SQL is not correct, because a IN may not have more than one selected attribute. I don't know though how to rewrite the query correctly in the mind of rocket_tag. Any idea? Is this a error at all or am I using rocket_tags incorrectly. There has to be a way to achieve tag_cloud for subsets.
The text was updated successfully, but these errors were encountered: