When `acts-as-taggable-on`'s `.tagged_with()` is used with `any: true`,
the gem will use `SELECT *` regardless of any previous (or following) requests
of selecting a limited amount of columns.
Given that the `articles` table has [73 columns](https://dev.to/admin/blazer/queries/314-number-of-columns-in-all-tables)
that will amount to wasted RAM memory for columns we don't need.
By "unscoping" any previous `select()` we can optimize used memory.
Before:
```ruby
[24] pry(main)> Article.tagged_with([:ruby], any: true).select(:id, :name).to_sql
=> "SELECT \"articles\".*, \"articles\".\"id\", \"name\" FROM \"articles\" WHERE EXISTS (SELECT * FROM \"taggings\" WHERE \"taggings\".\"taggable_id\" = \"articles\".\"id\" AND \"taggings\".\"taggable_type\" = 'Article' AND \"taggings\".\"tag_id\" IN (SELECT \"tags\".\"id\" FROM \"tags\" WHERE (\"tags\".\"name\" LIKE 'ruby' ESCAPE '!')))"
```
Note, how the SQL query is `articles.*, articles.column_a`
After:
[25] pry(main)> Article.tagged_with([:ruby], any: true).unscope(:select).select(:id, :name).to_sql
=> "SELECT \"articles\".\"id\", \"name\" FROM \"articles\" WHERE EXISTS (SELECT * FROM \"taggings\" WHERE \"taggings\".\"taggable_id\" = \"articles\".\"id\" AND \"taggings\".\"taggable_type\" = 'Article' AND \"taggings\".\"tag_id\" IN (SELECT \"tags\".\"id\" FROM \"tags\" WHERE (\"tags\".\"name\" LIKE 'ruby' ESCAPE '!')))"
```
`articles.*` is gone :-)
- https://github.com/mbleigh/acts-as-taggable-on/issues/936
- 47da5036de/lib/acts_as_taggable_on/taggable/tagged_with_query/any_tags_query.rb (L2-L8)
* Fixing link focus
1. Removing display content from link
2. Removing extra margin at the top of link
3. Adding before link
* Extending crayon-fields and removing margin-top
* Log params[:token] and destroy_token to Honeycomb when token mismatch
* Refactor #confirm_destroy and add Honeycomb fields for error logging
* Add tests around Honeycomb error logging in #confirm_destroy to spec
* Remove logging of user to Honeycomb in #confirm_destroy and in spec
* Cache only the static badge achievement data for notifications
* Cache the image too, but at what cost...? 🤔
* Add data update script to clear badge achievement notifications' caches
* Remove unnecessary cache for badge achievement notifications
* feat: add an error column to the data update script
* feat: save the error to the error field
* feat: save the error when the script fails
* feat: show the script error on the data update script page
* chore: pass the error to mark_as_failed instead of having its own function
* refactor: use presence
* test: ensure that we test an error case of a data update script
* chore: rename errorneous to failing
* test: update some specs, working on the others
* chore: update tests now that there are two files
* chore: change error from a string to a text to allow for more char
* Update copy
* Allow relative URLs and normalize on save
* Update specs
* Move clarification from index to form
* Add data update script
* Update spec
* Use proper Mailchimp newsletter IDs respective to methods
* Add guard clauses when Mailchimp newsletter isn't enabled
* Rubocop correction
* Only unsub after destroy if Mailchimp newsletter is enabled
* Refactor a bit
* Fix typo
* Fix boolean logic for guard clauses
* Update tests to account for new SiteConfig logic
* Break guard clause into two clauses
* Fix deprecation warnings in Images::Optimizer
The deprecation warnings were:
warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
warning: The called method `cloudinary' is defined here
and
warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
warning: The called method `imgproxy' is defined here
* Fix deprecation warning in Slack::Messengers::ArticlePublished
The deprecation warning was:
warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
warning: The called method `initialize' is defined here
* Frontend Ready for Connect Report Abuse
* add feedback api
* js defination fix
* Added Hooks to the Component
* add json response in feedback
* Block popup added
* fix render issue
* Made changes in internal view
* change error message
* Added few design changes =
* add test cases
* Update app/javascript/chat/actions/requestActions.js
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
* add PR suggestions
* add backend test cases
* report abuse form close
* Update app/javascript/chat/actions/requestActions.js
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
* Update app/javascript/chat/ReportAbuse/index.jsx
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
* add test cases
* Update app/javascript/chat/ReportAbuse/index.jsx
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
* Update app/javascript/chat/ReportAbuse/index.jsx
Co-authored-by: Marcy Sutton <holla@marcysutton.com>
* Update app/javascript/chat/ReportAbuse/index.jsx
Co-authored-by: Marcy Sutton <holla@marcysutton.com>
* group the fieldset
* fix report abuse api
* fix test case
* fix request test case
* fix typo
* cleaned up markup in report abuse component.
* Fixed spacing between abuse options.
* Fixed wording in report abuse confirmation.
* Removed unnecessary data-testid and aria-label attributes.
* Added some top margin to the report abuse form.
* Update app/javascript/chat/message.jsx
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* Added a legend to the the fieldset.
* Update app/javascript/chat/actions/requestActions.js
Co-authored-by: Michael Kohl <citizen428@dev.to>
Co-authored-by: Sarthak <7lovesharma7@gmail.com>
Co-authored-by: Narender Singh <narender2031@gmail.com>
Co-authored-by: Marcy Sutton <holla@marcysutton.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Display message from the back end when leaving a channel
Co-authored-by: jacobherrington <jacobherringtondeveloper@gmail.com>
Co-authored-by: Alberto Pérez de Rada Fiol <apdrf.94@gmail.com>
Co-authored-by: Michael Kohl <citizen428@dev.to>
* Allow image upload even if no existing image
Allow profile image upload even if there's no profile image attached.
* Add specs to ensure profile image field is there
Specs to ensure that the profile image upload field is always
available wether the user has a profile picture or not.
* allow keyboard access to dropdown stories
* add accessibility notes to dropdown stories
* manage focus in html example
* Update reference to aria attributes in notes
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
* add focus style to link for keyboard users
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
* secure Identity#email in case of missing auth_data_dump hash (#11936)
* Refactor Identity#email
* Delete wrongly commited debugging line
* extract no email found message into Const
* refactor Identity#email to use || as flow control
* Refactored all site config default hardcoded value in rspec test
* Remove Liquid::BlockBody patch (#12313)
* Refactored all site config default hardcoded value in rspec test
* Added seperate function to fetch default site confif value and using it in specs
Co-authored-by: rhymes <rhymes@hey.com>
* Adds guard clauses and better error messages to UsersController #confirm_destroy
* Adds tests around guard clauses in UsersController #confirm_destroy
* Adds a custom error for invalid tokens in UsersController#confirm_destroy
* Refactor user_destroy_token.rb initialize method to be more succinct
* Removes unnecessary code from user_self_destroy_spec.rb and fixes failing InvalidToken spec
* Reworks code in #confirm_destroy to be consistent with other #destroy methods
* Adjust token mismatch test to use mismatched tokens
* Refactors #confirm_destroy and adds a before_action to Users::Controller
- Reworks the logic within #confirm_destroy and removes excess code
- Adds set_or_sign_in_user before_action for #confirm_destroy
- Removes custom InvalidToken error message
* Cleans up spec and adds an additional test around logged out user edge case
* Fixes failing tests due to changes in #confirm_delete flow
* Adjusts test logic in user_self_destroy_spec.rb
* Refactors code by removing custom before_action and rewriting conditionals
* Create new MarkdownProcessor::Fixer services
* Remove old MarkdownFixer
* Code cleanup
* Capitalize Base in code comments
* Remove comments related to inheritance
* Add fix_methods method to hold METHDOS constant
* Use Ransack for admin/tags
* Update admin tags index to use search with Ransack
* Add feature to sort tags in /admin/tags
* Add test for viewing /admin/tags pages
* Add aria labels for sort links
* Make links a bit more accessible
* Refactor test a bit
* Account for URL encoding when redirecting to /confirm-email
* Fix failing spec
* Use correct method to encode + and @
* Fix test
* Don't encode things I don't need to (thanks Nick)