Conversation
8d1c9d1 to
062b2c9
Compare
|
Will this also work for the search bar? For instance you could use |
062b2c9 to
8fe2c37
Compare
GET /@:username/tagged/:hashtag GET /api/v1/accounts/:id/statuses?tagged=:hashtag
2b72637 to
eb6672e
Compare
eb6672e to
425a876
Compare
| end | ||
|
|
||
| def hashtag_scope | ||
| Status.tagged_with(Tag.find_by(name: params[:tag].downcase)&.id) |
There was a problem hiding this comment.
Not sure what the project's preference is, but I've been seeing a lot of people move from #[] to #fetch() since it tells the reader a lot more about the intent. For example, in this method we EXPECT :tag to be a key, thus params.fetch(:tag), but if we didn't params.fetch(:tag, nil) and of course we get all the niceness of #fetch's other default api: fetch(:key) {dynamicvalue}.
Either way, seems like what you want here could also be expressed as: Status.tagged_with(Tag.where(name: params[:tag]).pluck(:id).first), though if tagged_with allows an array you can just drop .first.
* Add hashtag filter to profiles GET /@:username/tagged/:hashtag GET /api/v1/accounts/:id/statuses?tagged=:hashtag * Display featured hashtags on public profile * Use separate model for featured tags * Update featured hashtag counters on-write * Limit featured tags to 10
* Add hashtag filter to profiles GET /@:username/tagged/:hashtag GET /api/v1/accounts/:id/statuses?tagged=:hashtag * Display featured hashtags on public profile * Use separate model for featured tags * Update featured hashtag counters on-write * Limit featured tags to 10
Allow browsing a profile by a specific hashtag. Useful for artists.
Public profile change:
GET /@:username/tagged/:hashtagREST API change:
GET /api/v1/accounts/:id/statuses?tagged=:hashtagTODO: