Title: The active model `where` method should act as a normal parameterized scope · Issue #116 · hyperstack-org/hyperstack · GitHub
Open Graph Title: The active model `where` method should act as a normal parameterized scope · Issue #116 · hyperstack-org/hyperstack
X Title: The active model `where` method should act as a normal parameterized scope · Issue #116 · hyperstack-org/hyperstack
Description: Currently returns nil if used on a AR class, and throws a non-related error if used on a scope. THIS WAS THE ORIGINAL CONCLUSION BUT ITS INCORRECT SEE DISCUSSION: The reasons we won't implement where is that it could be used to insecurel...
Open Graph Description: Currently returns nil if used on a AR class, and throws a non-related error if used on a scope. THIS WAS THE ORIGINAL CONCLUSION BUT ITS INCORRECT SEE DISCUSSION: The reasons we won't implement whe...
X Description: Currently returns nil if used on a AR class, and throws a non-related error if used on a scope. THIS WAS THE ORIGINAL CONCLUSION BUT ITS INCORRECT SEE DISCUSSION: The reasons we won't implement...
Opengraph URL: https://github.com/hyperstack-org/hyperstack/issues/116
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The active model `where` method should act as a normal parameterized scope","articleBody":"Currently returns nil if used on a AR class, and throws a non-related error if used on a scope.\r\n\r\n\r\nTHIS WAS THE ORIGINAL CONCLUSION BUT ITS INCORRECT SEE DISCUSSION: \r\n\u003e The reasons we won't implement where is that it could be used to insecurely determine counts on data. \r\nFor example `Customers.where(top_secret_attribute: true).count` could be executed from the JS console to find the count of customers with the top_secret_attribute.\r\n\r\n`where` should be implemented as a scope. \r\n\r\nWe will need to add scope called `__hyperstack_internal_where_scope` \r\n\r\n```ruby\r\nclass ActiveRecord::Base \r\n scope __hyperstack_internal_where_scope, \r\n -\u003e(attrs) { where(attrs) }, # server side we just call where\r\n filter: -\u003e(attrs) { !attrs.detect { |k, v| self[k] != v } # client side optimization\r\n def self.where(attrs) \r\n __hyperstack_internal_where_scope(attrs)\r\n end if RUBY_ENGINE == 'opal'\r\nend\r\n```\r\n\r\nOn the client side we can add the class level `where` method to `ActiveRecord::Base` and which simpy calls the `__hyperstack_internal_where_scope.\r\n\r\n","author":{"url":"https://github.com/catmando","@type":"Person","name":"catmando"},"datePublished":"2019-01-28T16:43:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/116/hyperstack/issues/116"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:72e35a23-d282-3aab-30b0-223016448e48 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EAA4:95C88:BFB3C9:F3093C:699182B6 |
| html-safe-nonce | 2d862579823cd545bea1f95d121b1336374aa85cce237cf170c3bdaea168c1e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQUE0Ojk1Qzg4OkJGQjNDOTpGMzA5M0M6Njk5MTgyQjYiLCJ2aXNpdG9yX2lkIjoiMTYxNTYyMzA5MDc2MDI2MDM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 207bb0378d5b92642852c4fe43c41b49c7e7674a603a4db337d2b0317a9ed32e |
| hovercard-subject-tag | issue:403904872 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/hyperstack-org/hyperstack/116/issue_layout |
| twitter:image | https://opengraph.githubassets.com/34c1cbb7c8a514e204ed75e30b9ac52769f1b24a9d4209a85cee29075951357e/hyperstack-org/hyperstack/issues/116 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/34c1cbb7c8a514e204ed75e30b9ac52769f1b24a9d4209a85cee29075951357e/hyperstack-org/hyperstack/issues/116 |
| og:image:alt | Currently returns nil if used on a AR class, and throws a non-related error if used on a scope. THIS WAS THE ORIGINAL CONCLUSION BUT ITS INCORRECT SEE DISCUSSION: The reasons we won't implement whe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | catmando |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/hyperstack-org/hyperstack git https://github.com/hyperstack-org/hyperstack.git |
| octolytics-dimension-user_id | 34562730 |
| octolytics-dimension-user_login | hyperstack-org |
| octolytics-dimension-repository_id | 145879576 |
| octolytics-dimension-repository_nwo | hyperstack-org/hyperstack |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 145879576 |
| octolytics-dimension-repository_network_root_nwo | hyperstack-org/hyperstack |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width